struts Dude wrote:
You don't have to use a filter though, you could make a base action that
does puts the bean into session and have all your actions sub-class that
one.
Using action to put bean in Session after SecurityFilter, how is that
possible when after authentication by SecurityFilter, u taken right
back to /user/abc.do where u 1st request it and doesn't pass
through to action attribute as specified in action-mapping of
struts-config.xml?
you create a base class like
public class BaseAction extends Action {
public ActionForward execute(...){
... do stuff that every action needs, eg checking for/putting user bean in session
}
}
Then your other actions do something like this
public class MyFirstAction extends BaseAction { public ActionForward execute(...){ super.execute(...);
... do whatever your action does
} }
This way, the piece of code that you want every action to execute is in one place.
Is that the url you tried to access or was it something in the securityfilter-config.xml? Whatever it is, it's missing the .do at the end eg /admin/Logon.do.I have tried to use action, after authentication, I am indeed taken back to the page /admin/logon.do or /user/logon.do and got error message in browser:
HTTP Status 400 - Invalid path /admin/Logon was requested
message Invalid path /admin/Logon was requested
description The request sent by the client was syntactically incorrect
(Invalid path /admin/Logon was requested).
But if it is in the securityfilter-config.xml as a login form then it is wrong, as only administrators can access /admin/*
-------------
My action mapping is struts-conf.xml
Both
<action path="/admin/Logon.do" type="org.apache.struts.actions.ForwardAction" parameter="LogAction.do?action=logon"/>
<action path="/user/Logon.do" type="org.apache.struts.actions.ForwardAction" parameter="LogAction.do?action=logon"/>
<!-- My LogAction extends DispatchAction and will try
to put User bean in session. -->
or
<action path="/admin/Logon.do" type="org.apache.struts.actions.ForwardAction" parameter="Welcome.do"/> <action path="/user/Logon.do" type="org.apache.struts.actions.ForwardAction" parameter="Welcome.do"/>
won't work.
-----------------------
BTW, how wud u use html:form to display login fields?
I can't get struts tag to work with login fields except for using things like:
<form action="j_security_check" method="POST"> Username: <input type="text" name="j_username"><p> Password: <input type="password" name="j_password"><p> <input type="Submit">
</form>
Don't know about html:form - i use something like you have done.
Struts is sitll happy to use filters - it was created before filters existed. It really comes down to what you are happy with and what level of container you want your app to work with.------------------
Ok, using filter (as u said) after SecurityFilter wud solve this simply but
I like to stick with pure Struts approach if possible.
Thanks
Jason Lea
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Jason Lea