File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

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
Marshal

Joined: Jan 10, 2002
Posts: 61309
    
  66

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%>">
</jsp:include>
Dan
 
GeeCON Prague 2014
 
subject: Problems with jsp:include