fmt:message inside c:forEach
mvitale Apr 20, 2005 2:54 PMI'm building an internationalized web app that needs to be deployed on JBoss 4.0.1SP1. It's my understanding that JB4 comes with Tomcat 5.0.28 inside it. More on that later.
So I have my JSP page, and it contains the following code:
<span align="left"><fmt:message key="OrderList.Label.PlaceNewOrder" bundle="${myResources}" /> <select name="orderType"> <option selected value="0"><Select Order Type></option> <c:forEach items="${OrderListForm.orderTypeList}" var="result"> <%-- <option value="${result.id}">1</option> --%> <option value="${result.id}"> <fmt:message key="${result.description}" bundle="${myResources}" /> </option> </c:forEach> </select> </span>
When I go to view this JSP page inside JB4, I receive the following error:
An exception of the class javax.servlet.jsp.JspException: ServletException in '/jsp/oe/OrderList.jsp': Unable to compile class for JSP Generated servlet error: /usr/local/jboss-4.0.1sp1/server/default/work/jboss.web/localhost/_/org/apache/jsp/jsp/oe/OrderList_jsp.java:176: _jspx_meth_fmt_message_1(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext,int[]) in org.apache.jsp.jsp.oe.OrderList_jsp cannot be applied to (org.apache.taglibs.standard.tag.rt.core.ForEachTag,javax.servlet.jsp.PageContext,int[]) if (_jspx_meth_fmt_message_1(_jspx_th_c_forEach_0, _jspx_page_context, _jspx_push_body_count_c_forEach_0)) ^ 1 error arose
If, however, I enable the line just containing "1" for the displayed value, and comment out the fmt:message and surrounding option tags, the code works and displays beautifully inside JB4. A quick view of the source even shows that ${result.id} is changing as expected.
So, back to Tomcat, as mentioned above. I went out and downloaded Tomcat 5.0.28 from the Jakarta site and installed it locally. I deployed the exact same .war file that's in my JB server/default/deploy directory, and went to the same Order List page as above (with the fmt:message enabled). TC5.0.28 is able to display this page correctly, with no problems.
What am I doing wrong? Why does the same .war file work in standalone Tomcat 5.0.28, but fails inside JBoss (which contains Tomcat 5.0.28)?
Thanks,
Mike