I have thought about this a bit lately and I never came up with a good
solution. In this case, you are sort of hacking the framework by using
our view library to render the UI, but the processing happens
elsewhere. That's why I don't know if there is a good solution to
sprinkle in some validation as well, since validation is handled as a
function of the processing.

I have thought about trying to put an action out in front of
j_security_check. I am not sure if it would work, but you can try to
create a thin action that has the getters/setters for j_username /
j_password, then dispatch to j_security_check. I don't know if you're
feeling up to it, but if you hack around enough and find a way to
pre-process the form with struts then hand it off to j_security_check,
I'd be interested in how you did it.

-Wes

On Wed, Jun 17, 2009 at 11:06 AM, Daniil Petrov<petro...@gmail.com> wrote:
> Hi,
>
> I am using JAAS authentication in a Struts 2 web application. A login form
> looks like:
>
>    <s:form method="post" action="j_security_check">
>        <s:textfield label="User" name="j_username"/>
>        <s:password label="Password" name="j_password"/>
>        <s:submit value="Log In"/>
>    </s:form>
>
> I need to validate password field before passing it to the authentication
> service. Basically, I need to check that this field is not empty. Struts 2
> suggests two ways for validation: either implement validate() method in
> action or configure field validators in xml file. But in this case I do not
> have a particular action, because j_security_check is something
> container-dependent. What validation can be done in this case?
>
> Thanks,
> Daniil
>



-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to