File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "problem with jsp:include" Watch "problem with jsp:include" New topic

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

Joined: Jan 10, 2002
Posts: 60810

"I get an error" is not very informative.

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

Joined: Nov 07, 2002
Posts: 298
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..

Engin Okucu
Ranch Hand

Joined: Feb 09, 2002
Posts: 174
Hi Leandro ,
Try as follow :
String page=null;
<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.
jQuery in Action, 2nd edition
subject: problem with jsp:include
Similar Threads
include a html page in JSP file
problem with include files
how to include jsp page in jsf
JSP Includes