File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Container authentication and Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Container authentication and Struts" Watch "Container authentication and Struts" New topic

Container authentication and Struts

Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
My action class extends LookupDispatchAction class.
Assume the class implements readAction() and updateAction().

How can I configuer the DD so that some users can read and some users can update?

In the DD:


The <url-pattern> specify the url to the action class, and not a method.
Is there anywhay of configuering this declerativly?


SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
An action mapping has a "roles" attrubute that you can use to assign which roles defined in the container have access to this action. So, as long as you use a separate action mapping when you intend to call either readAction or updateAction, you can define different roles for each. To me it would still make more sense to put each method in its own Action class since you have to define a separate mapping for each anyway.
[ March 21, 2007: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
I agree. Here's the link:
subject: Container authentication and Struts
jQuery in Action, 3rd edition