Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

jsp page content by permissions if - else if -else . Better way?

809301Jan 6 2011 — edited Jan 10 2011
Hi All

I'm looking for a tutorial or a design pattern or something to overcome the following:

In a jsp page code such as this works fine but is far from ideal.
<% if( isAdmin ) { %>
some html
<% } %>

<% if( isEditor ) { %>
some different html
<% } %>

<% if( isPublisher ) { %>
some different html again
<% } %>
I'm guessing there is a better technique? For example, if I add another role/user-type all the above may have to change on a whole load of pages.

Using struts by the way, not sure if it can help?

Thanks Very Much
J
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 7 2011
Added on Jan 6 2011
4 comments
712 views