You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Mattox <mi...@verideon.com> on 2005/08/18 17:59:44 UTC

Need help using tiles taglib with JSTL

I'm trying to use the tiles taglib with JSTL (servlet spec 2.4).. if I use
just the HTML tags they work file, and JSTL 1.1 by itself works fine. The
problem comes when I need to use them together.  Here I have a list of
inscriptions in the request scope and I want to loop through them and pass
each one to a tile to display each one (individually).  I can't figure out
the way to call the tiles:useAttribute tag:

<c:forEach items="${listeInscriptions.inscriptions}" var="inscription">

  <tiles:insert name="web-inscription" flush="true">
    <tiles:useAttribute id="${inscription}"
                        classname="fr.data.Inscription"
                        name="inscription"
                        scope="request"
                        ignore="false"/>
  </tiles:insert>

</c:forEach>

I'd be grateful for a bit of help with this.  I've tried asking about
mixing struts tags & JSTL in the past week but haven't had a concrete
example like this and now I'm really stuck. :)

-Michael



--
This E-mail is confidential.  It may also be legally privileged.  If you are
not the addressee you may not copy, forward, disclose or use any part of it.
If you have received this message in error, please delete it and all copies
from your system and notify the sender immediately by return E-mail.
Internet communications cannot be guaranteed to be timely, secure, error or
virus-free.  The sender does not accept liability for any errors or omissions.


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


Re: Need help using tiles taglib with JSTL

Posted by Michael Mattox <mi...@verideon.com>.
> <c:forEach items="${listeInscriptions.inscriptions}" var="inscription">
>
>   <tiles:insert name="web-inscription" flush="true">
>     <tiles:useAttribute id="${inscription}"
>                         classname="fr.data.Inscription"
>                         name="inscription"
>                         scope="request"
>                         ignore="false"/>
>   </tiles:insert>
>
> </c:forEach>

I figured it out.. the problem was the JSTL var in the forEach was limited
in scope to the tag.  I was trying to pass this object to the other tile
but really making it available in request scope is enough.  So I ended up
doing this:

<c:forEach items="${listeInscriptions.inscriptions}" var="inscription">

  <c:set var="inscription"
         value="${inscription}"
         scope="request"
         />

  <tiles:insert name="web-inscription"/>
  <P>

</c:forEach>

It may work with the c:set using page scope, I will have to try.  The more
I learn JSTL the less I use the struts taglibs. :)




--
This E-mail is confidential.  It may also be legally privileged.  If you are
not the addressee you may not copy, forward, disclose or use any part of it.
If you have received this message in error, please delete it and all copies
from your system and notify the sender immediately by return E-mail.
Internet communications cannot be guaranteed to be timely, secure, error or
virus-free.  The sender does not accept liability for any errors or omissions.


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


Re: Need help using tiles taglib with JSTL

Posted by Jurn Ho <ju...@magicmonster.com>.
nested within the tiles:insert, I think you want a tiles:put instead 
of a useAttribute?

Jurn

At 01:59 AM 19/08/2005, Michael Mattox wrote:
>I'm trying to use the tiles taglib with JSTL (servlet spec 2.4).. if I use
>just the HTML tags they work file, and JSTL 1.1 by itself works fine. The
>problem comes when I need to use them together.  Here I have a list of
>inscriptions in the request scope and I want to loop through them and pass
>each one to a tile to display each one (individually).  I can't figure out
>the way to call the tiles:useAttribute tag:
>
><c:forEach items="${listeInscriptions.inscriptions}" var="inscription">
>
>   <tiles:insert name="web-inscription" flush="true">
>     <tiles:useAttribute id="${inscription}"
>                         classname="fr.data.Inscription"
>                         name="inscription"
>                         scope="request"
>                         ignore="false"/>
>   </tiles:insert>
>
></c:forEach>
>
>I'd be grateful for a bit of help with this.  I've tried asking about
>mixing struts tags & JSTL in the past week but haven't had a concrete
>example like this and now I'm really stuck. :)
>
>-Michael


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