Magazine
 
Struts2 Tags

Output of the labelTag.jsp:

10. Optiontransferselect Tag (Form Tag) Example

The Optiontransferselect tag is a UI tag that creates an option transfer select component. There are two <select ...> tags with buttons in the middle of them, which allows options in each of the <select ...> to be moved between them. It auto-selects all its elements upon its containing form submission.

Add the following code snippet into the struts.xml file.

<action name=”optiontransferselectTag”>
<result>/pages/formTags/
optiontransferselectTag.jsp</result>
</action>

Create a jsp using the tag <s:optiontransferselect> This tag creates an option transfer select component. This tag
contains various parameters:

The label parameter sets label expression used for rendering a element specific label. In our case we have set it to “Employee Records”

The name parameter sets the name for the element. In our case we have set it to “leftSideEmployeeRecords”
The leftTitle parameter sets the left title. In our case we have set it to “RoseIndia”
The rightTitle parameter sets the right title. In

 

our case we have set it to “JavaJazzUp”
The headerKey sets the header key of the given list. It must not be empty. In our case we have set it to:”headerKey”
The headerValue sets the header value of the given list. In our case we have set it to:”— Please Select —”
The doubleName sets the name for complete component. In our case we have set it to:”rightSideEmployeeRecords”
The doubleHeaderKey sets the header key for the second list. In our case we have set it to:”doubleHeaderKey”
The doubleHeaderValue sets the header value for the second list. In our case we have set it to:”— Please Select —”

optiontransferselectTag.jsp

<%@ taglib prefix=”s” uri=”/struts-tags”
%>
<html>
<head>
<title>Optiontransferselect Tag
Example!</title>
</head>
<body>
<h2>Optiontransferselect Tag Example</
h2>
<s:form>
<s:optiontransferselect
label=”Employee Records”
name=”leftSideEmployeeRecords”
leftTitle=”RoseIndia”
rightTitle=”JavaJazzUp”
list=”{‘RI_Emp1’,
‘RI_Emp2’,’RI_Emp3',’RI_Emp4',’RI_Emp5'}”
headerKey=”headerKey”
headerValue=”— Please Select —”
doubleName=”rightSideEmployeeRecords”
doubleList=”{‘JJU_Emp1’,
‘JJU_Emp2’,’JJU_Emp3',
‘JJU_Emp4’,’JJU_Emp5'}”
doubleHeaderKey=”doubleHeaderKey”
doubleHeaderValue=”— Please Select —”
/>
</s:form>
</body>
</html>

Feb 2008 | Java Jazz Up | 45
 
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