Magazine
 
Struts2 Tags

<title>Doubleselect Tag Example</title>
</head>
<body>
<h2>Doubleselect Tag Example</h2>
<s:form>
<s:doubleselect label=”Select Item”
headerValue=”— Please Select —”
headerKey=”1" list=”{‘Color’,’Fruits’}”
doubleName=”dishes”
doubleList=”top == ‘Color’ ?
{‘Black’,’Green’,’White’,
‘Yellow’,’Red’,’Pink’} : {
‘Apple’,’Banana’,’Grapes’,’Mango’}” />
</s:form>
</body>
</html>

Output of the doubleselectTag.jsp:

7. File Tag (Form Tag) Example

The file tag is a UI tag that renders an HTML file input element achieved through browsing.

Add the following code snippet into the

struts.xml file
<action name=”fileTag”>
<result>/pages/formTags/fileTag.jsp</
result>
</action>

 

Create a jsp using the tag <s:file> It renders an HTML file input element. The parameters name is used to set a name for element which we have used as
name=”uploadFile” and the parameter accept is the HTML accept attribute that indicates the accepted file mime types which we have used as accept=”text/*”.

fileTag.jsp

<%@ taglib prefix=”s” uri=”/struts-tags” %>
<html>
<head>
<title>File Tag Example</title>
</head>
<body>
<h2>File Tag Example</h2>
<b>File Name</b>
<s:form>
<s:file name=”uploadFile” accept=”text/*”
/>
</s:form>
</body>
</html>

Output of the fileTag.jsp

8. Form Tag Example

The form tag is a UI tag that renders HTML an input form. The remote form allows the form to be submitted without the page being refreshed. The results from the form can be inserted into any HTML element on the page.

Feb 2008 | Java Jazz Up | 43
 
previous
index
next
 
View All Topics
All Pages of this Issue
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 ,

Download PDF