Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
JSPs - changing contents on user role

JSPs - changing contents on user role

2005-02-16       - By Jerry Osme?a

 Back
Reply:     1     2     3     4  

Jon,

I agree with your solution. I believe it is the right way to do it. This is the
same as the view helper pattern with custom tag strategy in Core J2EE pattern.
Refer to the following link for more info.  http://www.corej2eepatterns.com
/Patterns2ndEd/ViewHelper.htm

Cheers,

Jerry

jon <jon@(protected)> wrote:
Hello all,

I'm in the middle of solving a problem I'm sure others have solved, and
thought I'd bounce it off everyone to see if there's a well-established
pattern for this kind of thing.

We have users who have different roles.

Based on those roles they have the following rights to various fields of an
html form:
1) No access
2) Read access
3) Update access

If they have update access, we show an  [input]  tag, if they have read access
they get the text version, and for no access the element is skipped from
display.

I can think of about a half dozen ways to do this, from scriptlet
if-then-else, with STRUTS, or a custom tag. I'm looking most
closely at a custom tag, for instance:


[input]  ...





The tag class would know the role already (from the request or session), then
go against a database to determine the level of access for the given field,
and evaluate the body.

I'm just interested to hear if this approach has been tried, and if people
have good experiences with it? Or any other recomendations, blueprints,
patterns I should be considering.

Thank-you,
Jonathan Petruk
jon@(protected)

====================================================================
Companion Site: http://www.corej2eepatterns.com
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)

__ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

====================================================================
Companion Site: http://www.corej2eepatterns.com
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
<DIV>Jon,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I agree with your solution. I believe it is the right way to do it. This
is the same as the view helper pattern with custom tag strategy in Core J2EE
pattern. Refer to&nbsp;the following link for more info. &nbsp;<A href="http:/
/www.corej2eepatterns.com/Patterns2ndEd/ViewHelper.htm">http://www
.corej2eepatterns.com/Patterns2ndEd/ViewHelper.htm</A></DIV>
<DIV>&nbsp;</DIV>
<DIV>Cheers,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Jerry&nbsp;<BR><BR><B><I>jon &lt;jon@(protected)&gt;</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER
-LEFT: #1010ff 2px solid">Hello all,<BR><BR>I'm in the middle of solving a
problem I'm sure others have solved, and<BR>thought I'd bounce it off everyone
to see if there's a well-established<BR>pattern for this kind of thing.<BR><BR
>We have users who have different roles.<BR><BR>Based on those roles they have
the following rights to various fields of an<BR>html form:<BR>1) No access<BR>2
) Read access<BR>3) Update access<BR><BR>If they have update access, we show an
<INPUT> tag, if they have read access<BR>they get the text version, and for no
access the element is skipped from display.<BR><BR>I can think of about a half
dozen ways to do this, from scriptlet<BR>if-then-else, <logic:equal>with STRUTS
, or a custom tag. I'm looking most<BR>closely at a custom tag, for instance:<BR
><BR><HASACCESS type="update" name="field1"><BR><INPUT name=field1> ...<BR><
/HASACCESS><BR><HASACCESS type="read"><BR><?=
valueof(field1) ?><BR></HASACCESS><BR><BR>The tag class would know the role
already (from the request or session), then<BR>go against a database to
determine the level of access for the given field,<BR>and evaluate the body.<BR
><BR>I'm just interested to hear if this approach has been tried, and if people
<BR>have good experiences with it? Or any other recomendations, blueprints,<BR
>patterns I should be considering.<BR><BR>Thank-you,<BR>Jonathan Petruk<BR>jon
@(protected)<BR><BR>=============================================================
=======<BR>Companion Site: http://www.corej2eepatterns.com<BR>J2EE BluePrints:
http://java.sun.com/blueprints/corej2eepatterns<BR>List Archive: http:/
/archives.java.sun.com/archives/j2eepatterns-interest.html<BR>Unsubscribing:
email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)<BR></BLOCKQUOTE>
</logic:equal><p>__ ____ ____ ____ ____ ____ ____ ____ ____ ____ __<br>Do You
Yahoo!?<br>Tired of spam?  Yahoo! Mail has the best spam protec
tion
around <br>http://mail.yahoo.com
====================================================================
Companion Site: http://www.corej2eepatterns.com
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.