0

Hi,
I have a page where I include another page passed via url
Url is something like

http://www.daniweb.com/newthread.jsp?page=24

and I get the variable as

String thePage = request.getParameter("page") ;

Now I want to include it in my page and the code below doesn't work. I have googled and I cannot understand why I cannot get relevant result. Please help

<jsp:include page=<%=thePage%> flush="true"></jsp:include>
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Stefano Mtangoo
0

First you missed the double quotes for page attribute. The line should be

<jsp:include page="<%=thePage%>" flush="true"></jsp:include>

Also you can only use relative urls for the page attribute.
As per the docs,
The relative URL looks like a pathname--it cannot contain a protocol name, port number, or domain name. The URL can be absolute or relative to the current JSP page. If it is absolute (beginning with a /), the pathname is resolved by your web or application server.

Hope this helps

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.