I am new to Struts 2 and I have a list box in which I have to set up some values which are being fetched from my action class now I am able to set up that value but the problem is it is setting up that values as option's ID and value both as below..
The list passed to the JSP should contain both the ID and text to display.
John Cena
Greenhorn
Joined: May 05, 2010
Posts: 6
posted
0
Thanks 4 your reply ...
Can you please explain bit further.. please...
I am having 2 Lists mapped in "ArrayList"..
as following
"proj" contains suppose 2 strings "Project - 1" and "Project - 2" and "projId" contains their Ids suppose "1" and "2" and I want "Project - 2" option to be default selected when my page loads.....
and both variables are declared in my action class.
Use that. Otherwise the default list box tag won't work: it expects a single list with the appropriate data in it. Don't you already have a project class you're using to hold this information?
John Cena
Greenhorn
Joined: May 05, 2010
Posts: 6
posted
0
I had mentioned above as well that I am having action class and have declared the arrayList in the same class as well,...
I don't know what else to tell you--the list box expects a single list containing both the option value and text. If that doesn't suit your needs you'll either need to do it manually, or be more descriptive with what you're trying to accomplish.
John Cena
Greenhorn
Joined: May 05, 2010
Posts: 6
posted
0
Thankx for your reply..
I am copying my pages' code here, that might explain my point to you..
public List getProj(){
proj.add("Project - 1");
proj.add("Project - 2");
return proj;
}
public List getProjId(){
projId.add("1");
projId.add("2");
return projId;
}