Announcement Announcement Module
Collapse
No announcement yet.
I18n with select taglib Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • I18n with select taglib

    My TourLength enum
    Code:
    BELOW_WEEK(2, 5, "tourlength.below_week"), 
    WEEK (6, 8, "tourlength.week"), 
    OVER_WEEK (9, 21, "tourlength.over_week");
    private TourLength(int min, int max, String label) {
    	this.min = min;
    	this.max = max;
    	this.label = label;
    }
    //the rest...
    I want to put text from my properties to select spring tag. I tried to:
    Code:
    			
    <form:label path="length">Length of stay</form:label>
      <form:select path="length">
      <form:options items="${tourLengthList}" itemLabel="<spring:message code="label"/>" />
    </form:select>
    but doesn't work.

    I found this
    Code:
    <form:select path="length">
     <c:forEach var="tmp" items="${tourLengthList}">
      <form:option value="${tmp['label']}">
      <spring:message code="${tmp['label']}" />
      </form:option>
     </c:forEach>
    </form:select>
    and it works but maybe someone knows better way?
Working...
X