You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Nelson, Laird" <La...@FMR.COM> on 2003/05/07 00:41:59 UTC
logic:iterate problem (long examples)
We're using Struts 1.0.2. I could use another set of eyeballs on this; I'm
sure it's a naive JSP problem and not an issue with <logic:iterate>, but on
the off chance....
If I do this:
<logic:iterate id="practice"
type="java.lang.String"
name="ri"
scope="page"
property="practices"/>
<bean:write name="practice" scope="page"/><br>
</logic:iterate>
...everything works fine ("ri" is a bean shoved in page scope earlier in the
page that has a getPractices() method that returns a String array).
If I do this:
<logic:iterate id="practice"
type="java.lang.String"
name="ri"
scope="page"
property="practices"/>
<bean:message bundle="<%= DisplayBenefitsSummaryAction.MESSAGES_KEY
%>"
key="<%= practice %>"/>
</logic:iterate>
...I get a JSP compilation error claiming that "practice" is not declared:
C:\workspace\online_retirement\.metadata\.plugins\com.ibm.etools.server.core
\tmp0\cache\localhost\Default_Server\NetbenefitsApp\integratedservices.war\o
ripages\_DisplayBenefitsSummary_jsp_18.java:312: Undefined variable:
practice
_jspx_th_bean_message_0.setKey( practice );
^
1 error
(Assume that the bundle is there.)
If I do this:
<logic:iterate id="practice"
type="java.lang.String"
name="ri"
scope="page"
property="practices"/>
<bean:message bundle="<%= DisplayBenefitsSummaryAction.MESSAGES_KEY
%>"
key="<%= (String)pageContext.getAttribute("practice")
%>"/>
</logic:iterate>
...I get this:
org.apache.jasper.compiler.ParseException:
R:\FeBGladiator\NetBenefits\MaximusWebApp\Web
Content\oripages\DisplayBenefitsSummary.jsp(34,67) JSPG0069E: Attribute
practice has no value
How can I get access to the value of the practice bean named by the "id"
attribute of the <logic:iterate> tag? And why can <bean:write> see it, but
no amount of gross runtime expressioning will cause <bean:message>'s "key"
attribute to see it?
Thanks,
Laird
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org