JSPs - changing contents on user role 2005-02-16 - By jon
Back 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, <logic:equal> with STRUTS, or a custom tag. I'm looking most closely at a custom tag, for instance:
<hasAccess name="field1" type="update"> <input name="field1"> ... </hasAccess> <hasAccess type="read"> <?= valueof(field1) ?> </hasAccess>
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)
|
|