File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes s:select and s:iterator question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "s:select and s:iterator question" Watch "s:select and s:iterator question" New topic

s:select and s:iterator question

Neelima Vemu

Joined: Jan 16, 2010
Posts: 12

I am trying to build a drop down box in my jsp which has some filenames fetched from DB. I am getting these names as a list into fileNamesList which has elementData like

[EmergencyNames( filename=Default_Campaign, ), EmergencyNames( filename=DelayPost_Holiday, ), EmergencyNames( filename=EDGE_or_MSP_Down, ), EmergencyNames( filename=Hi_Volume_Easypay, ), EmergencyNames( filename=Hi_Volume_Easypay_2, ), EmergencyNames( filename=InitialEmergencyWav, )

I just want to show filenames for example Default_Campaign. But instead it shows EmergencyNames( filename=Default_Campaign, in the drop down list with the code below in jsp.

Any help to let me know how to go to the next level of arraylist would be really helpful, I have tried using s:iterator in the jsp, but was not successful. I would also like to save the user selected filename into the DB from this drop down list.

Thanks for your help and time!
Ankit Dan
Ranch Hand

Joined: Aug 31, 2012
Posts: 47

If you have a complex object in your list
like a user dto and it contains firstname and last name

you can use the listKey and listValue attribute of struts select tag
listKey is the value that ll be submitted and listValue is the attribute that ll be displayed on the list

for example my userList contains the user dto objects
and the user dto has the fields firstName and lastName and i want two selects one for first name and another for last name
so for first name:

for last name

hope this helps

I agree. Here's the link:
subject: s:select and s:iterator question
It's not a secret anymore!