I apologize as this is a generic jsp question and not specific to struts, but
hopefully this is a simple one (at least, I give a struts example below).  Is
it possible to use a tag as an rtexprvalue within another tag's parameter
field?  For example (assuming 'mytag' can take a rtexprvalue for parameter
'param'):

<tag:mytag param="<tag:anothertag param=\"hello\"/>"/>


As a struts example, here are two versions to show a dynamic list of simple
menu items (there's a java.util.Collection attribute named "menu" attached to
the request; it's a collection of beans with properties 'href' and 'text'),
which differ only on the second line.  The first version is quite ugly but
works.  The second version is what I'd like to use, but this doesn't work --
causes a compile exception.  I'm assuming the answer to my question is "no",
but does this mean I'm stuck with version 1, or is there a better way?


ver 1:
<logic:iterate id="menuitem" collection="<%=request.getAttribute(\"menu\")%>">
  <form:link href="<%=((com.hotu.intra.MenuItem)
pageContext.getAttribute(\"menuitem\")).getHref()%>">
    <bean:write name="menuitem" property="text"/>
  </form:link>
  <br>
</logic:iterate>


ver 2:
<logic:iterate id="menuitem" collection="<%=request.getAttribute(\"menu\")%>">
  <form:link href="<bean:write name=\"menuitem\" property=\"href\"/>">
    <bean:write name="menuitem" property="text"/>
  </form:link>
  <br>
</logic:iterate>


compile exception:
/home/newsham/work/intranet/main.jsp:30: ')' expected.
          _jspTag3.setHref("<bean:write name="menuitem" property="href"/>");
                                              ^
1 error

com.caucho.java.JavaCompileException: /home/newsham/work/intranet/main.jsp:30:
')' expected.
          _jspTag3.setHref("<bean:write name="menuitem" property="href"/>");
                                              ^
1 error


Thanks,

Jim Newsham

Reply via email to