Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML

Search:
   Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML Facing Programming Problem? Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Struts
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
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:

                         

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

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

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

Latest Tutorials:
Styles in HTML
Style Tags Used in HTM
Check Box in HTML
Action Submit Html
Cascading Style Sheet(
Horizontal Rule Attrib
Horizontal Rule in HTM
Show Hyperlink in HTML
Unordered Lists
Paragraph in HTML
Password Field in HTML
Radio Buttons in HTML
Set Background Colors
Table & the Border att
Text Area in HTML
Text Field in HTML
Use of Text Field
Table Caption in HTM
J2ME Servlet Example
J2ME Cookies Example
J2ME Frame Animation2
J2ME Frame Animation
J2ME RMS Read Write
J2ME Record Data Base
J2ME Audio Record
J2ME Record Listener
J2ME Text Box Example
J2ME Timer Animation
J2ME Vector Example
J2ME Video Control Exa
J2ME Event Handling Ex
J2ME HashTable Example
J2ME Icon MIDlet Examp
J2ME Image Item Exampl
J2ME Image Example
J2ME Item State Listen
J2ME Key Codes Example
J2ME KeyEvent Example
J2ME Label Example
J2ME Random Number
J2ME Read File
J2ME RMS Sorting Examp
J2ME Timer MIDlet Exam
Custom Item in J2ME
Creational Design Patt
Design Patterns
Throwing Run time exce
Grid in Echo3
Creating Table in Echo
JPA Introduction
Java bigdecimal toBigI
Java bigdecimal shortV
Java bigdecimal shortV
Java bigdecimal signum
Java bigdecimal stripT
Java bigdecimal subtra
Java bigdecimal subtra
Java bigdecimal toBigI
Java bigdecimal toEngi
Java bigdecimal toPlai
Java bigdecimal toStri
Java bigdecimal ulp ex
Java bigdecimal unscal
Java bigdecimal valueO
Java bigdecimal valueO
Java bigdecimal valueO
Java bigdecimal setSca
Java bigdecimal setSca
Java bigdecimal scaleB
Java bigdecimal scale
Java bigdecimal round
Java bigdecimal remain
Java bigdecimal remain
Java bigdecimal precis
Java bigdecimal pow me
Java bigdecimal pow ex
Java bigdecimal plus m
Java bigdecimal plus e
Java bigdecimal negate
Java bigdecimal negate
Java bigdecimal multip
Java bigdecimal multip
Java BigDecimal movePo
Java bigdecimal movePo
Java bigdecimal min ex
Java bigdecimal max ex
CheckBox component in
Visibility of Componen
Loading delay componen
Simple input applicati
Opening a new window i
Hello World in Echo3 f
Use of Local Inner cla
JSP bean set property
Java Method Synchroniz
Java Method Return Val
JAVA Method Wait
JDBC vs ORM
Java BigDecimal divide
Java BigDecimal divide
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

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