hi,
i need to populate my combo with options taken from the FormBean and
compared with the Enum values.

i have it working but i doubt it's the best way to do it (and it mixes too
much struts tags with jstl ones, in my opinion)

anybody can help?


<[EMAIL PROTECTED] import="MyPackage.*" //this package contains the class with 
the enum
used further down %>

<%! String val; %>
<html:form action="/full_profiloGiocoRespAutoesclusione">
 <label>WANT TO DO THIS?</label> 
 <% String d2 = "session"; %>
 <logic:notEmpty name="MyFormBean" property="duration">
  <bean:define id="d1" name="MyFormBean" property="duration"/>
  <% d2 = d1.toString();%>
 </logic:notEmpty>
<fieldset>
 <label for="question">Choose duration</label>
 <html:select property="duration" name="MyFormBean">
 <%
  QuestionValues value;
  String d = "session";
  if (d2 != null) {
    d = d2;
  }
  if ("day".equals(d)) {
    value = QuestionValues.day;
  } 
  else if ("week".equals(d)) {
    value = QuestionValues.week;
  } else {
    value = QuestionValues.session;
  }
  for (QuestionValues v : QuestionValues.values()) {
    if (v.compareTo(value) >= 0) {
      val = (String) (v.getLabel());
  %>
  <html:option value='<%=val%>'><%=val%></html:option>
  <% }
  } 
  %>
  </html:select>
 </fieldset>
</html:form>
-- 
View this message in context: 
http://www.nabble.com/populate-combo-after-comparing-bean-values-with-enum-tp17882097p17882097.html
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to