Home Struts Struts2 Struts2uitags Doubleselect Tag (Form Tag) Example



Doubleselect Tag (Form Tag) Example
Posted on: July 28, 2007 at 12:00 AM
In this section, we are going to describe the doubleselect tag . The doubleselect tag is a UI tag that renders two HTML select elements with second one changing displayed values depending on selected entry of first one.

Doubleselect Tag (Form Tag) Example

     

In this section, we are going to describe the doubleselect tag. The doubleselect tag is a UI tag that renders two HTML select elements with second one changing displayed values depending on selected entry of first one.

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

<action name="doubleselectTag">
  <result>/pages/uiTags/doubleselectTag.jsp</result>
</action>

Create a jsp using the tag <s:doubleselect> that renders two HTML select elements with second one changing displayed values depending on selected entry of first one. This tag contains various parameters:

The headerKey parameter sets the header key of the second list. Must not be empty. In our case we have set it to"1"
The headerValue parameter sets the header value of the second list.  In our case we have set it to "--- Please Select ---"
The doubleName parameter sets the name for complete component. In our case we have set it as : doubleName="dishes" 
The doubleList sets the second iterable source to populate from. In our case we have set it as :

   doubleList="top == 'Color' ? {'Black','Green','White',
  'Yellow','Red','Pink'} : { 'Apple','Banana','Grapes','Mango'}" 

doubleselectTag.jsp

<%taglib prefix="s" uri="/struts-tags" %>

<html>
  <head>
  <title>Doubleselect Tag Example!</title>
  </head>
  <body>
<h1><span style="background-color: #FFFFcc">Doubleselect Tag Example!
</span></h1>

  <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:

Related Tags for Doubleselect Tag (Form Tag) Example:
htmlcjspselectdisplaydoublevaluetagusingelementrendercreateelementsjsctewithvaluesselectedeithangsplpefirsthanginginmlmntplaytrjispchangingesemendentrypenmedotrysspginathtmisirhaeavatwssrenthcondstaluhatdispendingplndono


More Tutorials from this section

Ask Questions?    Discuss: Doubleselect Tag (Form Tag) Example   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.