You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mi...@jpmorgan.com on 2002/12/05 15:11:31 UTC

jsp:include with variables in struts

Hi,

I wish to include a number of jsps within my main jsp. The list of include
files is retrieved from the database and stored in the ActionForm. I can
then have a piece of jsp code as follows:

<logic:iterate id="section" name="screenForm" property="sectionList">
      <jsp:include page="<bean:write name='section' property='url'/>" flush
="true"/>
</logic:iterate>

However, this doesn't work because 'jsp:include' is parsed before
'bean:write'. It tries to include a file which is literally called
'<bean:write......'

Can anyone offer a suggestion as to how I can achieve my goal? I am using
Struts 1.0.2.

Thanks in advance
Michael


This communication is for informational purposes only.  It is not intended as
an offer or solicitation for the purchase or sale of any financial instrument
or as an official confirmation of any transaction. All market prices, data
and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of J.P. Morgan Chase & Co., its
subsidiaries and affiliates.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: jsp:include with variables in struts

Posted by Kris Schneider <kr...@dotech.com>.
Or with JSTL:

<logic:iterate id="section" name="screenForm" property="sectionList">
  <c:import url="${section.url}"/>
</logic:iterate>

or

<c:forEach var="section" items="${screenForm.sectionList}">
  <c:import url="${section.url}"/>
</c:forEach>

Quoting Gemes Tibor <ge...@regens.hu>:

> 2002. december 5. 15:11 dátummal michael.j.coyle@jpmorgan.com ezt írtad:
> > Hi,
> >
> > I wish to include a number of jsps within my main jsp. The list of
> include
> > files is retrieved from the database and stored in the ActionForm. I can
> > then have a piece of jsp code as follows:
> >
> > <logic:iterate id="section" name="screenForm" property="sectionList">
> >       <jsp:include page="<bean:write name='section' property='url'/>"
> flush
> > ="true"/>
> > </logic:iterate>
> 
> You cannot insert a taglib into a taglib. So try 
> 
> <logic:iterate id="section" name="screenForm" property="sectionList">
>        <jsp:include page="<% section.getUrl() %>" flush="true"/> 
> </logic:iterate>
> 
> Tib
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


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

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: jsp:include with variables in struts

Posted by Gemes Tibor <ge...@regens.hu>.
2002. december 5. 15:11 dátummal michael.j.coyle@jpmorgan.com ezt írtad:
> Hi,
>
> I wish to include a number of jsps within my main jsp. The list of include
> files is retrieved from the database and stored in the ActionForm. I can
> then have a piece of jsp code as follows:
>
> <logic:iterate id="section" name="screenForm" property="sectionList">
>       <jsp:include page="<bean:write name='section' property='url'/>" flush
> ="true"/>
> </logic:iterate>

You cannot insert a taglib into a taglib. So try 

<logic:iterate id="section" name="screenForm" property="sectionList">
       <jsp:include page="<% section.getUrl() %>" flush="true"/> 
</logic:iterate>

Tib

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>