Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with jsp:include

 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"I get an error" is not very informative.
bear
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jasperexception
not valid attribute
 
Sri Basavanahally
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you really, really!
It did work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic