You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by av...@za.safmarine.com on 2002/12/12 14:28:11 UTC

/ /OREF:CPT9CFB3 RE: dropdowns being reset

<!-- Define the Client Cargo Bean as a bean to be used on this JSP:
            Name of bean: clients,
            Key in application scope: clientCargoBean,
            Attribute to be used: types (the ArrayList of Client
Beans),
            Type of the attribute: Collection
-->
<bean:define id="clients" name="clientCargoBean" property="types"
type="java.util.Collection"/>

<!-- Each option's name and value is the specific Client Bean's id
and name.-->
  <html:select property="client.name" >
      <html:options collection="clients"  property="id" labelProperty
="name"/>
    </html:select>



                                                                                                                                       
                      david.heagney@ac                                                                                                 
                      centure.com              To:      "Struts Users Mailing List" <st...@jakarta.apache.org>                   
                                               cc:                                                                                     
                      12/12/2002 03:07         Subject: RE: dropdowns being reset                                                      
                      PM                                                                                                               
                      Please respond                                                                                                   
                      to "Struts Users                                                                                                 
                      Mailing List"                                                                                                    
                                                                                                                                       
                                                                                                                                       
                                                                                                                                       
                                                                                                                                       
                                                                                                                                       





Is there any way you could mail me sample code for this Options tag?

Thanks,
David



              shirishchandra.sakhare@ubs.
              com                                 To:
struts-user@jakarta.apache.org
                                                  cc:
              12/12/2002 12:33                    Subject: RE:
dropdowns being reset
              Please respond to "Struts
              Users Mailing List"





try using html:options instead..and supply it with the collection or
array
of
indexes...

because if in html:select u specify property attribute, and the
property is

there in the request(which should be the case when u forward the
request
back
to same jsp with errors..),the same is used to preselect a element.
I think may be as u are using html:ootion in a loop, u are having
this
problem.

regards,
Shirish

-----Original Message-----
From: david.heagney [mailto:david.heagney@accenture.com]
Sent: Thursday, December 12, 2002 1:17 PM
To: struts-user; david.heagney
Subject: dropdowns being reset


Hi,

I have a page in my STRUTS app which dynamically populates a dropdown
list:

Month

<html:select property="fromMonth">
<option value="--">--
<% for (int i=1; i <= 12; i++) { %>
      <option value="<%= i %>"><%= getMonthName (i) %>
<% } %>
</html:select>

getMonthName() returns the month as a string based in the passed
integer, 1
- 12.

If the user submits the form and leaves out a required field, the
above
dropdown gets re-set, i.e. doesn't retain the selection when the page
is
refreshed with it's errors... does anyone know how i can avoid this?

Thanks,
David


This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information.  If you
have
received it in error, please notify the sender immediately and delete
the
original.  Any other use of the email by you is prohibited.


--
To unsubscribe, e-mail:   <
mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:struts-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <
mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:struts-user-help@jakarta.apache.org>




This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information.  If you
have
received it in error, please notify the sender immediately and delete
the
original.  Any other use of the email by you is prohibited.


--
To unsubscribe, e-mail:   <
mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:struts-user-help@jakarta.apache.org>






--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>