This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes problem with jsp:include Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "problem with jsp:include" Watch "problem with jsp:include" New topic
Author

problem with jsp:include

Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
Hi, I want to include a different page depending on some requests... for example:
<%
String page=request.getParameter("page");
%>
<jsp:include page="<%=page%>"/>
But I get an error... can somebody help me??
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61090
    
  66

"I get an error" is not very informative.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
jasperexception
not valid attribute
Sri Basavanahally
Ranch Hand

Joined: Oct 07, 2003
Posts: 75
the page that you are declaring and initializing is local that block. Use a declaration block for declaring it. Then it will be accessible throughout the page.
This is probably your problem..


UP THE IRONS !
Engin Okucu
Ranch Hand

Joined: Feb 09, 2002
Posts: 174
Hi Leandro ,
Try as follow :
<%!
String page=null;
%>
<%
page=request.getParameter("page");
%>
<jsp:include page="<%=page%>"/>
Create an index.html file and write http://localhost:8080/epfc/index.jsp?page=index.html. It works fine.
Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
thank you really, really!
It did work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with jsp:include