• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with jsp:include

 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
send the full code of the page so that it will better understand the problem.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
danny liu
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My option is:
<jsp:include page="table.jsp?" flush="true">
<jsp aram name="ART_TYPE" value="<%=choice%>">
</jsp:include>
Dan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic