You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Lee <ml...@hotmail.com> on 2002/09/17 22:29:07 UTC

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>