my dog learned polymorphism
The moose likes JSP and the fly likes Problems with jsp:include Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Problems with jsp:include" Watch "Problems with jsp:include" New topic

Problems with jsp:include

john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
I have the following
String choice = (String)col.get(y);
System.out.println("Choice is = " + choice);
<jsp:include page="table.jsp?ART_TYPE=<%=choice%>" flush="true" />
The print line statement prints the appropriate choice however in table.jsp (String)request.getParameter("ART_TYPE");
returns null. However if I place a String in

<jsp:include page="table.jsp?ART_TYPE=Animal" flush="true" /> it works.
What am I doing wrong?
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
send the full code of the page so that it will better understand the problem.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

Interesting. Most custom actions will throw an error if you try to piece together an attribute value with a partial scriptlet expression like you are doing. <jsp:include> doesn't throw an error, but it obviously isn;t doing what you expect either.
You'd be better off forming the while URL in the String (or this might be a good time to investigate the <c:url> tag of the JSTL), along the lines of:

[Asking smart questions] [About Bear] [Books by Bear]
danny liu
Ranch Hand

Joined: Jan 22, 2004
Posts: 185
My option is:
<jsp:include page="table.jsp?" flush="true">
<jsp aram name="ART_TYPE" value="<%=choice%>">
I agree. Here's the link:
subject: Problems with jsp:include
It's not a secret anymore!