• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 s:select has no value

 
Katie Doody
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 83
Java Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like its a typo....your code is this



you need to change it to this



Hope this helps...
 
Katie Doody
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevermind, I figured out my problem and it was not a struts issue. Thanks for your help!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic