In this example, you will see the implementation of optiontransferselect tag of struts2.2.1. The Optiontransferselect tag is a generic UI tag that creates an option transfer select component. There are two <select ...> tags with buttons in the middle of them. With the help of these button tag, you can transfer selected data form one select box to another select box.
Directory structure of optiontransferselect tag example.1- index.jsp
|
<html> <head><title>Struts2.2.1_Optiontransferselect_Example1</title> <style type="text/css"> hr{margin: 0;}</style></head> <body> <h2>Struts2.2.1_Optiontransferselect_Example1</h2><hr> <a href="optionTransfer.action">_Option Transfer Select_</a> </body> </html> |
2-optionTransfer.jsp
|
<%@taglib uri="/struts-tags" prefix="s" %> <html> <head><title>Struts2.2.1_Optiontransferselect_Example1</title></head> <body><h2>Struts2.2.1_Optiontransferselect_Example1</h2><hr> <s:form action="resultAction.action"> <s:optiontransferselect leftTitle="List of indian cities.. " headerKey="0" headerValue="----Select Indian city-----" name="IndiaCity" list= "indianCityName" doubleHeaderKey="0" doubleHeaderValue="----Select American city-----" rightTitle="List of American cities... " doubleList="americanCityName" doubleName="americanCity"> </s:optiontransferselect><s:submit> </s:submit> </s:form></body> </html> |