File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Including pages based on condition Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Including pages based on condition" Watch "Including pages based on condition" New topic

Including pages based on condition

Aleksey Matiychenko
Ranch Hand

Joined: Apr 03, 2001
Posts: 178
I have a JSP that needs to include different set of HTML based on the user permissions.
RIght now I just redirect the page to a different page but I would rather jast have a common html and then include the appropriate parts if the user have persmissions for them.
Any ideas ?
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
You can use <jsp:include page="page to include" flush="true"/>
try it.
Sunetra Saha
Ranch Hand

Joined: Feb 25, 2001
Posts: 77
Wouldn't a simple if condition enclosing the offending portion in {} work for you? i.e
<% if (user role = x ) {%>
<% } %>
I agree. Here's the link:
subject: Including pages based on condition
It's not a secret anymore!