This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts 2  s:select has no value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2  s:select has no value" Watch "Struts 2  s:select has no value" New topic
Author

Struts 2 s:select has no value

Katie Doody
Ranch Hand

Joined: Nov 03, 2006
Posts: 90
I am sure this is something simple but I am getting an arraylist from the database containing last name, first name and a unique id. I am trying to display this arraylist in a select box. Here is the code in my jsp:

<s:select> cssClass="SmallText" label="Choose a Lawyer" name="lawyerENbr" headerKey="-1" headerValue="-- Please Select --" list="lawyerList" listValue="lawyerFirstName" listKey="lawyerENbr" </s:select>


The lawyerList is my arraylist. Right now I am only trying to display the first name until I get it working. I will then get the first name and last name to display.

lawyerFirstName is the first name in my transfer object. lawyerENbr is the unique identifier in my transfer object.

At the moment my select list is empty. Can anyone tell me what I am doing wrong?

Thanks for your help.
Sachin Joshi
Ranch Hand

Joined: Aug 06, 2008
Posts: 83

Looks like its a typo....your code is this



you need to change it to this



Hope this helps...


Web Development Tips and Tutorials - By Sachin
Katie Doody
Ranch Hand

Joined: Nov 03, 2006
Posts: 90
I apologize, that was the code that I had. It is not working. My label shows up but there is nothing in the select list. Can the object in the arraylist have more than the key and the value? Thanks.
Katie Doody
Ranch Hand

Joined: Nov 03, 2006
Posts: 90
Nevermind, I figured out my problem and it was not a struts issue. Thanks for your help!
 
 
subject: Struts 2 s:select has no value
 
Similar Threads
Need to know if I am doing this right or not
<s:select how to fill with key and value
Struts2: Retern all the values inside the list in my Action
Issue in <s:select..> Tag
selecting a value in dropdown