File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2  s:select has no value" Watch "Struts 2  s:select has no value" New topic

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!
I agree. Here's the link:
subject: Struts 2 s:select has no value
Similar Threads
Issue in <s:select..> Tag
Struts2: Retern all the values inside the list in my Action
Need to know if I am doing this right or not
selecting a value in dropdown
<s:select how to fill with key and value