This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 60810

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] [Bear's FrontMan] [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
Similar Threads
include a html page in JSP file
JSP and request variables
What is the use of having flush="true" in <jsp:include> tag in jsp?