Home Struts Struts Struts2.2.1 Tags Struts2.2.1 optiontransferselect  tag example.

Ask Questions?

View Latest Questions


 
 

Struts2.2.1 optiontransferselect  tag example.
Posted on: January 12, 2011 at 12:00 AM
Advertisement
Struts2.2.1 optiontransferselect tag example.

 3-optionTransferAction.java

package roseindia.action;

import java.util.ArrayList;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;

public class optionTransferAction extends ActionSupport {

private List<String> indianCityName;

private List<String> americanCityName;

private String IndiaCity;

private String americanCity;

public List<String> getIndianCityName() {

return indianCityName;

}

public void setIndianCityName(List<String> indianCityName) {

this.indianCityName = indianCityName;

}

public List<String> getAmericanCityName() {

return americanCityName;

}

public void setAmericanCityName(List<String> americanCityName) {

this.americanCityName = americanCityName;

}

public optionTransferAction()

{

/*----- Add India City in list------*/

indianCityName=new ArrayList<String>();

indianCityName.add("Bengaluru");

indianCityName.add("Delhi");

indianCityName.add("Mumbai");

indianCityName.add("Lucknow");

/*----- Add American City in list------*/

americanCityName=new ArrayList<String>();

americanCityName.add("New York");

americanCityName.add("Green Bay");

americanCityName.add("RichMond");

americanCityName.add("West Jordan");

americanCityName.add("CamBridge");

americanCityName.add("Bareilly");

}

public String getIndiaCity() {

return IndiaCity;

}

public void setIndiaCity(String indiaCity) {

IndiaCity = indiaCity;

}

public String getAmericanCity() {

return americanCity;

}

public void setAmericanCity(String americanCity) {

this.americanCity = americanCity;

}

public String execute() throws Exception {

return SUCCESS;

}

public String display() throws Exception {

return NONE;}

}

4_struts.xml

<struts>

<package name="roseindia" extends="struts-default" namespace="/">

<action name="optionTransfer" class="roseindia.action.optionTransferAction" method="display">

<result name="none" >jsppages/optionTransfer.jsp</result>

</action>

<action name="resultAction" class="roseindia.action.optionTransferAction">

<result name="success" >jsppages/outputoptionTransfer.jsp</result>

</action>

</package>

</struts>

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

<h4>City selected by client......</h4>

IndiaCity : <s:property value="IndiaCity"/><br/>

AmericanCity : <s:property value="americanCity"/>

</body></html>

index.gif

optiontransferTag.gif

SelectCityFortransfer.gif

Aftertransfer.gif In this, we are transferring  Bareilly from list of American city to Indian city. 

SelectCities.gif

CitySelectedByU.gif

Download Select Source Code


Related Tags for Struts2.2.1 optiontransferselect  tag example.:


DMCA.com