[thelist] JSP help please

Diane Soini dianesoini at earthlink.net
Tue Jan 13 19:30:32 CST 2004


Use the following:
<jsp:include page="includes/nav.jsp" flush="true"> (note that this tag 
isn't closed yet)
	<jsp:param name="section" value="plan" />
</jsp:include>
Then use in your include file:
<%
	String section = request.getParameter("section");
	if(section == null || section.length == 0 || section.equals("")) 
section = "defaultvalue";
%>
<ul id="subnav-<%= section%>">
   <li id="nav-index"><a href="/index.jsp"><%= section%></a></li>
   [etc, etc]
</ul>

<ul id="subnav-<%= section%>">
   <li id="nav-index"><a href="/index.jsp"><%= section%></a></li>
   [etc, etc]
</ul>

You'll need to come up with a way of determining what the value of your 
parameter should be so you can pass that to your include file. You can 
pass a variable in the value like this:
<jsp:param name="somename" value="<%=somevar%>" />

This is of course only one way you can do it --and probably not even 
the best. But it should at least give you an idea.

Diane

On Tuesday, January 13, 2004, at 10:58 AM, 
thelist-request at lists.evolt.org wrote:

> So my layout is like so:
>
> <body>
> <jsp:include page="includes/nav.jsp"/>
> content here
> </body>
>
> What I want to do is make the HTML in the nav.jsp include
> conditional, depending on what page the user is on. For example, if
> the section is "plan" then the HTML for the subnav for that section
> should show up, etc.



More information about the thelist mailing list