jpiser wrote:
I am new to Struts 2 and if anyone can help me out I would greatly appreciate
it.
I am populating a select box with a list of job titles. After posting the
form I want to the list to remember the previous selection. (Ridiculously
simple stuff right?) But, I am missing something because after the form is
submitted the list is always reset. This is the code I have for the select
box:

<s:select label="Title"
       name="title"
           tooltip="Please select your job title"
headerKey="0" headerValue="Select Title" listValue="titleName" listKey="name" list="titleList"
       value="selectedTitle"
       required="true" />

titleList is an ArrayList and it populates the options fine. I am
implementing the 'preparable" interface  in my action bean and populating
titleList in the prepare() method.

You have name="title" so you would need a setTitle() method on your action to capture the selected value. However, you have value="selectedTitle" so you're telling the tag to read the value from one property and store it to another. You probably want to remove the value attribute and use name="selectedTitle", with a setSelectedTitle() method. You only need value= if you explicitly want to get a value from somewhere other than the property the input is tied to.

HTH,

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to