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>

Recommended Answers

All 2 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.