Frameworks| Hibernate| Struts| JSF| JavaFX| Ajax| Spring| DOJO| JDO| iBatis| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Optiontransferselect Tag (Form Tag) Example 
 

In this section, we are going to describe the Optiontransferselect tag. The Optiontransferselect tag is a UI tag that create an option transfer select component.

 

Optiontransferselect Tag (Form Tag) Example

                         

In this section, we are going to describe the Optiontransferselect tag. 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.

NOTE: The id and doubleId parameters are not needed to supply as they will get generated  when the optiontransferselect tag is being used in a form tag. The generated id and doubleId will be <form_id>_<optiontransferselect_doubleName> and <form_id>_<optiontransferselect_doubleName> respectively.

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

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

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

The label parameter sets label expression used for rendering an 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>
     <link href="<s:url value="/css/main.css"/>" rel="stylesheet"
          type="text/css"/>  
  </head>
    <body>
  <h1><span style="background-color: #FFFFcc">Optiontransferselect 
                                           Tag Example!</span></h>

  <s:form>
    <s:optiontransferselect 
      label="Employee Records"
      name="leftSideEmployeeRecords"
      leftTitle="RoseIndia"
      rightTitle="JavaJazzUp"
      list="{'Deepak Kumar', 'Sushil Kumar','Vinod Kumar','Deepak Monthy',
                    'Deepak Mihanti', 'Sushil Kumar', 'Ravi Kant Kumar'}"

      headerKey="headerKey"
      headerValue="--- Please Select ---"
      doubleName="rightSideEmployeeRecords"
      doubleList="{'Amar Deep Patel', 'Amit Kumar','Chandan Kumar', 
                                 'Noor Kumar','Tammana Kumari'}"

      doubleHeaderKey="doubleHeaderKey"
      doubleHeaderValue="--- Please Select ---" />

  </s:form>
  </body>
</html>

Output of the optiontransferselectTag.jsp:

                         

» View all related tutorials
Related Tags: html text ui sed textarea tag tar render tex to ext e area use ml m end s at htm

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

6 comments so far (
post your own) View All Comments Latest 10 Comments:

a glorious achievement ..........GOD bless u....

Posted by sudhanshu pandey on Wednesday, 04.8.09 @ 10:45am | #86629

Struts2UiTags need any extra js/jar file?
for autocomplete test it gives following resopnse.

<html><head><title>Apache Tomcat/6.0.14 - Error report</title><style><!--H1 {font-family:Tahoma,Arial

,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif

;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color

:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black

;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76

;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black

;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - </h1><HR

size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description

</b> <u>The requested resource () is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache

Tomcat/6.0.14</h3></body></html>

Posted by Metro on Friday, 06.13.08 @ 11:57am | #63182

I have the same problem of not being able to capture the selected list in the action class. I had wasted more than a day on this. Anybody, any ideas?? Any kind of help would be greatly appreciated.

Thanks

Posted by rakesh on Thursday, 05.29.08 @ 01:48am | #61307

To solve the selected items issue when you submit the form, and avoid the "dojo is not defined", you need to change the .jsp and add:
<s:head theme="ajax" />

between the <head> tag

Posted by Alejandro on Friday, 02.8.08 @ 05:04am | #47561

the problem was that it need to be selected in the list of the right side to be submitted. You can't only move from left to right, need also to select the items.

This could be a bug, to solve it, you need to autoselect all in the list so that you don´t have to do it by yourself.

Congratulations for the website

Posted by martin on Wednesday, 01.16.08 @ 19:12pm | #45364

I Have an Optiontransferselect in a form but i dont know how to get the selected items in the rightlist back in my action.

I have tried with Type List, LinkedList, arraylist, String[], and i always get null.

when i look at de request in the parameters i also didn't have the parameters or when i do request.getParametersName().

I use firebug on my firefox and i always get a javascript error saying "dojo is not defined" on the javascript function generated automaticly when the tag is processed. Could this be the problem?

Can someone help me please?

Sorry for my english!

Thank you all!

Posted by martin on Wednesday, 01.16.08 @ 18:43pm | #45363

Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.