This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
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
jQuery in Action, 3rd edition