views:

155

answers:

1

Does Struts 2 has complete solution for simple login task? I have simple declaration in struts.xml:

  <package namespace="/protected" name="manager" extends="struts-default" >

    <interceptors>
        <interceptor-stack name="secure">
            <interceptor-ref name="roles">
                <param name="allowedRoles">registered</param>
            </interceptor-ref>
        </interceptor-stack>
    </interceptors>
    <default-action-ref name="pindex"/>

    <action name="pindex" >
        <interceptor-ref name="completeStack"/>
        <interceptor-ref name="secure"/>
        <result>protected/index.html</result>
    </action>
</package>

Accessing to this resource shows only (Forbidden 403). So what should I do on the next step to:

  1. Add login page (standart Tomcat declaration on web.xml with <login-config> not works) ?
  2. Provide security round trip. Do I need write my own servlet or exists struts2 solutions?

Thanks in advance!

A: 

can't you add a "error" or an "input" result on "pindex" action? such as

<result name="error">public/error.html</result>
ring bearer
Nothing changed. public/error.html is never invoked
Dewfy
Did you try "input" result ? `<result name="input">public/error.html</result>`
ring bearer
both of them, as error as input
Dewfy