aspose file tools*
The moose likes Servlets and the fly likes How can i implement security in field level Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How can i implement security in field level " Watch "How can i implement security in field level " New topic
Author

How can i implement security in field level

Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
Hello all

i need to find the best way to implement some kind of way security in the field level that means

to be able to determine if some combo box or text box can be edit or modified by some user according to som rules

it needs to be before the elements renders to the page ( can it be done by filters ? )

im using jsp and tomcat
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

It was discussed here. It can be done by filter if you wrap up a response and will provide your output stream which will control HTML content and cut protected elements. However this approach looks a bit complicated for me.


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Sounds like a simple application of <c:if> on the JSP pages that render the HTML to me.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
You can have a format (probably a xml structure) that would map user to the input elements that is unprotected for him for a particular page.Now you can write a taglib , that will make use of this xml to decide whether the field to be rendered should be protected or unprotected for this user.
In this way you will develope a complete infrastructure for handling this issue in the application.


Rahul Bhattacharjee
LinkedIn - Blog
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
I would go with Bear. Other options are just too much of work.
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
Hello all and thanks for the fast reply
filters is the answer indid but im trying to find implement it in as much as less painful way .
that is im trying to avoid adding ( surrounding ) the html elements with <c:if > and such . i have 600 pages
what im thinking about is ( i dont know if it can be done ) to add some function or some other thing to each html element
this function or indicator will be checked by the filter before it renders to the output . so all the logic will be in the filter side
and it be written once .
can it be done ?
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Meir Yan:
what im thinking about is ( i dont know if it can be done ) to add some function or some other thing to each html element
this function or indicator will be checked by the filter before it renders to the output . so all the logic will be in the filter side
and it be written once .
can it be done ?


It reminds me a custom JSF component I made for some similar kind of thing. Anyway, you can achieve this kind of behavior using custom tag. Filter is not the best solution here, I believe.
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
Thanks for the reply
well i cant do jsf because i dont have jsf only jsp but can you or someone please give me example code or some thing
to go from there ? for me to understand ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can i implement security in field level