You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Martin van Dijken <mv...@madocke.nl> on 2003/06/27 09:48:24 UTC

Dynamic includes

Hey gang,

As you all must know dynamic includes are of course extremely powerful. I can't seem to find a version of include that plays nicely with tags. I'd like to do an include based on the value of a tag:

<jsp:include>/content<mad:appType/>.jsp</jsp:include>

This would include /contentForum.jsp in the case of a forum. 

Now I've created a tag of this sort for our own taglibs using RequestDispatcher.include, but that one doesn't include in the context of the Page I was in. I've also looked at the <c:import> tag and I don't think that will do exactly what I need either.

Can anybody tell me:

A: Is there a form of include/import that allows using nested tags for resolving the url?
B: Is it possible to create a tag that includes within the page context/scope?

Thanks in advance,

Martin van Dijken

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


Re: Dynamic includes

Posted by Kris Schneider <kr...@dotech.com>.
Maybe something like this with JSTL:

<c:set var="path">/content<mad:appType/>.jsp</c:set>
<%-- not sure if you need this to make sure rewriting occurs --%>
<c:url var="url" value="${path}"/>
<c:import url="${url}"/>

Quoting Martin van Dijken <mv...@madocke.nl>:

> Hey gang,
> 
> As you all must know dynamic includes are of course extremely powerful. I
> can't seem to find a version of include that plays nicely with tags. I'd like
> to do an include based on the value of a tag:
> 
> <jsp:include>/content<mad:appType/>.jsp</jsp:include>
> 
> This would include /contentForum.jsp in the case of a forum. 
> 
> Now I've created a tag of this sort for our own taglibs using
> RequestDispatcher.include, but that one doesn't include in the context of the
> Page I was in. I've also looked at the <c:import> tag and I don't think that
> will do exactly what I need either.
> 
> Can anybody tell me:
> 
> A: Is there a form of include/import that allows using nested tags for
> resolving the url?
> B: Is it possible to create a tag that includes within the page
> context/scope?
> 
> Thanks in advance,
> 
> Martin van Dijken

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

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