Hi,
Is it possible to use old (Struts 1) select with struts 2.

Struts 2 select has mandatory attribute "list".

SO if struts 1 select code needs to be migrated to struts 2 then list(array
list etc.) has to be in action  classes.

In case there are local list in JSP page in struts 1 which uses "option" to
display the list dynamically it has to be written in action class in struts
2.

The code for the current approach is below:



<s:select name="locSubTypeCategory" cssStyle="width:130px"
onChange="populateLocID(document.forms[3].subType.value,document.forms[3].locSubTypeCategory.options[document.forms[3].locSubTypeCategory.selectedIndex].value)"
disabled="<%=(!canCreateBus);%>">

<%

                if(busCust!=null && busCust.size()>0){

            for(int k=0;k<busCust.size();k++)

                {
locTypeInfo =(LocTypeInfo)busCust.get(k);

%>

<option value="<%=locTypeInfo.getLocSubType()%>">
<%=locTypeInfo.getLocSubTypeDesc()%> </option>

<%

}} else if(corpCust!=null && corpCust.size()>0){


for(int k=0;k<corpCust.size();k++)

              {

                 locTypeInfo =(LocTypeInfo)corpCust.get(k);

%>

<option value="<%=locTypeInfo.getLocSubType()%>">
<%=locTypeInfo.getLocSubTypeDesc()%> </option>

<%

}} else if(govCust!=null && govCust.size()>0){


for(int k=0;k<govCust.size();k++)

                {

                     locTypeInfo =(LocTypeInfo)govCust.get(k);

%>

<option value="<%=locTypeInfo.getLocSubType()%>">
<%=locTypeInfo.geLocSubTypeDesc()%> </option>

<% }} %>

</s:select>


For struts 2 we have to remove the option and add the list (busCust,
corpCust) to action class is there any way that we can use this code with
minimal change or without change.

Thanks & Regards
Ashish

Reply via email to