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 15:52:07 UTC

logic:iterate help needed: "id" not available/broken/buggy?

OK, I've pared this back to the bare minimum:

<logic:iterate id="p"
               type="java.lang.String"
               name="ri"
               scope="page"
               property="practices"/>
  <bean:message bundle="bundleKey"
                key="<%= p %>"/> <!-- This fails; can't find p -->
</logic:iterate>

The runtime expression that I'm using as the key into the <bean:message>
lookup, <%= p %>, fails.  The JSP compiler says:

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:356: Undefined variable: p
_jspx_th_bean_message_0.setKey( p );
^
1 error

I've looked in the archives, on Google, in the FAQ and in the documentation,
and everything seems to indicate that I should be able to use a runtime
expression that refers to the value of the "id" attribute, but nothing I do
satisfies the JSP compiler.  What am I doing wrong?  I thought the
<logic:iterate> "id" attribute made its value available to future runtime
expressions.  Perhaps not?

The example, incidentally, that I'm following can be found at
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg16669.html.

Laird

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: logic:iterate help needed: "id" not available/broken/buggy?

Posted by Kris Schneider <kr...@dotech.com>.
Since you're using 1.0.2:

<bean:message key='<%= String.valueOf(pageContext.getAttribute("p")) %>'
              bundle="bundleKey"/>

Quoting Kris Schneider <kr...@dotech.com>:

> Docs say that id will be a page-scoped attribute, not a scripting variable.
> Maybe:
> 
> <bean:message name="p" bundle="bundleKey"/>
> 
> Quoting "Nelson, Laird" <La...@FMR.COM>:
> 
> > OK, I've pared this back to the bare minimum:
> > 
> > <logic:iterate id="p"
> >                type="java.lang.String"
> >                name="ri"
> >                scope="page"
> >                property="practices"/>
> >   <bean:message bundle="bundleKey"
> >                 key="<%= p %>"/> <!-- This fails; can't find p -->
> > </logic:iterate>
> > 
> > The runtime expression that I'm using as the key into the <bean:message>
> > lookup, <%= p %>, fails.  The JSP compiler says:
> > 
> >
> 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:356: Undefined variable: p
> > _jspx_th_bean_message_0.setKey( p );
> > ^
> > 1 error
> > 
> > I've looked in the archives, on Google, in the FAQ and in the
> > documentation,
> > and everything seems to indicate that I should be able to use a runtime
> > expression that refers to the value of the "id" attribute, but nothing I
> do
> > satisfies the JSP compiler.  What am I doing wrong?  I thought the
> > <logic:iterate> "id" attribute made its value available to future runtime
> > expressions.  Perhaps not?
> > 
> > The example, incidentally, that I'm following can be found at
> > http://www.mail-archive.com/struts-user@jakarta.apache.org/msg16669.html.
> > 
> > Laird
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > 
> 
> 
> -- 
> Kris Schneider <ma...@dotech.com>
> D.O.Tech       <http://www.dotech.com/>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: logic:iterate help needed: "id" not available/broken/buggy?

Posted by Kris Schneider <kr...@dotech.com>.
Docs say that id will be a page-scoped attribute, not a scripting variable. Maybe:

<bean:message name="p" bundle="bundleKey"/>

Quoting "Nelson, Laird" <La...@FMR.COM>:

> OK, I've pared this back to the bare minimum:
> 
> <logic:iterate id="p"
>                type="java.lang.String"
>                name="ri"
>                scope="page"
>                property="practices"/>
>   <bean:message bundle="bundleKey"
>                 key="<%= p %>"/> <!-- This fails; can't find p -->
> </logic:iterate>
> 
> The runtime expression that I'm using as the key into the <bean:message>
> lookup, <%= p %>, fails.  The JSP compiler says:
> 
> 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:356: Undefined variable: p
> _jspx_th_bean_message_0.setKey( p );
> ^
> 1 error
> 
> I've looked in the archives, on Google, in the FAQ and in the
> documentation,
> and everything seems to indicate that I should be able to use a runtime
> expression that refers to the value of the "id" attribute, but nothing I do
> satisfies the JSP compiler.  What am I doing wrong?  I thought the
> <logic:iterate> "id" attribute made its value available to future runtime
> expressions.  Perhaps not?
> 
> The example, incidentally, that I'm following can be found at
> http://www.mail-archive.com/struts-user@jakarta.apache.org/msg16669.html.
> 
> Laird
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: logic:iterate help needed: "id" not available/broken/buggy?

Posted by Mike Jasnowski <mj...@bea.com>.
Have you tried it w/o the scope attr?  Not sure what effect that would have,
but I have done what you are describing

<logic:iterate id="server" name="formBean" property="servers">
   <tr>

    ....

     <td>
         <bean:write name="server" property="attrName"/>
    </td>

    ....

  </tr>
</logic:iterate>

In Struts RC1 and it works fine.  Maybe you could pare the iterate tag down
a bit more.

HTH,
Mike

-----Original Message-----
From: Nelson, Laird [mailto:Laird.Nelson@FMR.COM]
Sent: Wednesday, May 07, 2003 9:52 AM
To: 'struts-user@jakarta.apache.org'
Subject: logic:iterate help needed: "id" not available/broken/buggy?


OK, I've pared this back to the bare minimum:

<logic:iterate id="p"
               type="java.lang.String"
               name="ri"
               scope="page"
               property="practices"/>
  <bean:message bundle="bundleKey"
                key="<%= p %>"/> <!-- This fails; can't find p -->
</logic:iterate>

The runtime expression that I'm using as the key into the <bean:message>
lookup, <%= p %>, fails.  The JSP compiler says:

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:356: Undefined variable: p
_jspx_th_bean_message_0.setKey( p );
^
1 error

I've looked in the archives, on Google, in the FAQ and in the documentation,
and everything seems to indicate that I should be able to use a runtime
expression that refers to the value of the "id" attribute, but nothing I do
satisfies the JSP compiler.  What am I doing wrong?  I thought the
<logic:iterate> "id" attribute made its value available to future runtime
expressions.  Perhaps not?

The example, incidentally, that I'm following can be found at
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg16669.html.

Laird

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org