Answer to #1)

<html:select property="companySelection">
        <html:option value="">Select a company</html:option>
        <html:options collection="companyList"                  
property="orglevel2id"          labelProperty="orglevel2name"/>
      </html:select>

The above sets the "Select a company" as the default.  I think if you 
wanted the default to be set in the collection you would just set it as 
the first entry when you make the collection.  Someone tell me if I am 
wrong on this one...


Answer to #2)
To display alternating colors, a bunch of us like:
http://edhill.its.uiowa.edu/display/




-----Original Message-----
From: mleejr [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 17, 2002 4:29 PM
To: struts-user
Subject: default value for html:select


I have one MAIN question. I don't want to have to repost a question. I 
try searching for answers to my questions on the website but it always 
forwards me to google. Are these emails not cached for searching?

Anyway, 2 questions;
1) How do I set a default value in an html:select on an options list? I 
need the default state to be the one loaded from the struts form.
    
    <html:select property="state" size="1" value="<%= userForm.state 
%>">
      <html:options name="allUnitedStates" labelName="allUnitedStates"/>
    </html:select>


2) I do a query. I put the result in  the logic:iterate below. I want to 
alternate colors. I've seen this before but I couldn't do a search 
because of the aforementioned problem. Thanks

      <logic:present name="users">
          <logic:iterate name="users" id="aUser" property="users" 
scope="request">
          <tr>
            <td><bean:write name="aUser" property="userID"/></td>
            <td><bean:write name="aUser" property="userType"/></td>
.....
          </tr>
        </logic:iterate>
      </logic:present>



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

Reply via email to