wood burning stoves*
The moose likes Struts and the fly likes Need to know if I am doing this right or not Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Need to know if I am doing this right or not" Watch "Need to know if I am doing this right or not" New topic
Author

Need to know if I am doing this right or not

Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Hey everyone, lots of people are having <s:select> tag,
I am having problems too but I feel like I am just one mistake away from the success

here is my action class



I would like someone to tell me if my setEmployeeType() is correct
because my drop-down is empty

here is the JSP



the URL to access it is http://localhost:8080/Pay_Roll/Pay_Roll/Action/Register.action

am I missing anything required attribute in <s:select> tag?

thanks for your help

Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
I got my drop-down list to work

I think I was missing listKey="key"
attribute

Anyways, I got it to work
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

setEmployeeType() is never called, so it's not doing what you think it will.

You need to initialize the list before hitting the JSP page: the "list" attribute is the list from which the select tag gets its values, for example in the execute() method, etc.
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Mr. Newton

Yes, you're right about that, I actually did move the list init to within execute() method

so it worked

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need to know if I am doing this right or not