tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick.Hollo...@alfie.demon.co.uk (Nick Holloway)
Subject Re: dynamic includes.
Date Thu, 14 Sep 2000 07:33:44 GMT
theo@vecnatech.com (Daniel A. Theobald) writes:
> I am trying to figure out how to do an include where the file to be
> included is specified in a user profile object.

Use the tag "<jsp:include>".  The following shows "x.jsp" which include
"a.jsp" if there is no query string, and "b.jsp" otherwise.

Tested with Tomcat 3.1.

    ==> x.jsp <==
    <% String inc = request.getQueryString() == null ? "a.jsp" : "b.jsp"; %>
    <h1>Heading</h1>
    <jsp:include page="<%= inc %>" flush="true"/>

    ==> a.jsp <==
    This is A.

    ==> b.jsp <==
    This is B.

-- 
 `O O'  | Nick.Holloway@pyrites.org.uk
// ^ \\ | http://www.pyrites.org.uk/

Mime
View raw message