[ 
https://issues.apache.org/struts/browse/WW-2851?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maria Kan updated WW-2851:
--------------------------

    Description: 
In struts.xml, login button is tied to LoginAction, however it sometimes goes 
into another action/page, RegisterAction/register_new_user.jsp.
The page works fine with FireFox and IE 7, but not IE 6.

Snippet of struts.xml
=================
<action name="doLogin_*" 
class="com.dds.paymentgateway.pgweb.enduser.actions.LoginAction" method="{1}">
                        <interceptor-ref name="defaultStack">
                                <!-- These are methods invoked from buttons on 
the login page. No validation needed. -->
                                <param 
name="validation.excludeMethods">input,register,gotoFirstPage,retPassword,reloadPrepaid</param>
                        </interceptor-ref>
                        <result name="input">/WEB-INF/pages/login.jsp</result>
                        <result name="success" 
type="redirect-action">reloadPrePaidUser_input</result>
                        <result name="register" 
type="redirect-action">register_input</result>
                        <result name="ret_pw" 
type="redirect-action">retrievePassword_input</result>
                        <result name="reload_pp" 
type="redirect-action">reloadPrePaidUser_inputFromLogin</result>
</action>

<action name="register_*" 
class="com.dds.paymentgateway.pgweb.enduser.actions.RegisterAction" 
method="{1}">
                        <interceptor-ref name="defaultStack">
                        <param 
name="validation.excludeMethods">input,populate,empty</param>
                        </interceptor-ref>
                        <interceptor-ref name="myToken">
                                <param 
name="excludeMethods">input,populate,empty</param>
                        </interceptor-ref>
                        <result 
name="input">/WEB-INF/pages/register_new_user.jsp</result>
                        <result name="success" 
type="redirect-action">doLogin_input</result>
                        <result 
name="invalid.token">/WEB-INF/pages/register_new_user.jsp</result>
</action>       

<action name="retrievePassword_*" 
class="com.dds.paymentgateway.pgweb.enduser.actions.RetrievePasswordAction" 
method="{1}">
                        <interceptor-ref name="defaultStack" />
                        <interceptor-ref name="myToken">
                                <param name="excludeMethods">input</param>
                        </interceptor-ref>
                        <result name="success" 
type="redirect-action">doLogin_input</result>
                        <result 
name="input">/WEB-INF/pages/retrieve_password.jsp</result>
                        <result 
name="invalid.token">/WEB-INF/pages/retrieve_password.jsp</result>
</action>
...

Snippet of login.jsp
================
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
<s:head theme="ajax" />
<title><s:text name="title.login"/></title>
<script type="text/javascript">
function submitForm()
{
        document.loginForm.submit();
}
</head>
<body >
...
<s:form name="loginForm" action="doLogin_retPassword" theme="simple">
<table>
....
<%
        /**
         * default form action "doLogin_retPassword" by passes validation:-
         * We will change to use default action when "Login" is pressed .
         * By default, we need to have the form action to not do any 
validation. Otherwise, any other modified action 
         * (eg. having javascript to change the form action's value) will all 
have login's validation associated with it, regardless
         * of struts.xml 's configured "validation.excludeMethods" param values 
for those actions.
                        (eg. we could have entered in one email field in the 
login form 
                                 and pressed "forgot password" link, and we'd 
be brought back to the login screen with
                                 "password is required" validation error).
         */
%>
......
                                       <!-- the login button -->
                                        <td><s:submit id="loginButton" 
type="button"
                                                cssStyle="width: 70px;" 
value="%{getText('login')}" action="doLogin" /></td>

                                         ....
                                      <!-- the Retrieve password link -->
                                       <td><!-- use javascript here to make the 
href do a submit -->
                                        <!-- this is done because otherwise 
form values won't get passed in correctly if submit isn't used. -->
                                        <s:a href="Forgot_Password" 
id="retPassword" cssClass="small" onclick="submitForm(); return false;">
                                                <s:text name="forgotpassword" />
                                        </s:a></td>

                                        .......
                                       <!-- register link -->
                                        <td><s:a href="doLogin_register.action" 
id="register" cssClass="small" onclick="submitForm();">
                                                <s:text name="notyetregistered" 
/>
                                        </s:a></td>
                                        ........
                                        <!-- the register button, next to the 
register link -->
                                        <td><s:submit type="button" 
value="%{getText('register')}"  action="doLogin_register" /></td>

                                          .....

  was:
In struts.xml, login button is tied to LoginAction, however it sometimes goes 
into another action/page, RegisterAction/register_new_user.jsp.
The page works fine with FireFox and IE 7, but not IE 6.

Snippet of struts.xml
=================
<action name="doLogin_*" 
class="com.dds.paymentgateway.pgweb.enduser.actions.LoginAction" method="{1}">
                        <interceptor-ref name="defaultStack">
                                <!-- There are methods invoked from buttons on 
the login page. No validation needed. -->
                                <param 
name="validation.excludeMethods">input,register,gotoFirstPage,retPassword,reloadPrepaid</param>
                        </interceptor-ref>
                        <result name="input">/WEB-INF/pages/login.jsp</result>
                        <result name="success" 
type="redirect-action">reloadPrePaidUser_input</result>
                        <result name="register" 
type="redirect-action">register_input</result>
                        <result name="ret_pw" 
type="redirect-action">retrievePassword_input</result>
                        <result name="reload_pp" 
type="redirect-action">reloadPrePaidUser_inputFromLogin</result>
</action>

<action name="register_*" 
class="com.dds.paymentgateway.pgweb.enduser.actions.RegisterAction" 
method="{1}">
                        <interceptor-ref name="defaultStack">
                        <param 
name="validation.excludeMethods">input,populate,empty</param>
                        </interceptor-ref>
                        <interceptor-ref name="myToken">
                                <param 
name="excludeMethods">input,populate,empty</param>
                        </interceptor-ref>
                        <result 
name="input">/WEB-INF/pages/register_new_user.jsp</result>
                        <result name="success" 
type="redirect-action">doLogin_input</result>
                        <result 
name="invalid.token">/WEB-INF/pages/register_new_user.jsp</result>
</action>       

<action name="retrievePassword_*" 
class="com.dds.paymentgateway.pgweb.enduser.actions.RetrievePasswordAction" 
method="{1}">
                        <interceptor-ref name="defaultStack" />
                        <interceptor-ref name="myToken">
                                <param name="excludeMethods">input</param>
                        </interceptor-ref>
                        <result name="success" 
type="redirect-action">doLogin_input</result>
                        <result 
name="input">/WEB-INF/pages/retrieve_password.jsp</result>
                        <result 
name="invalid.token">/WEB-INF/pages/retrieve_password.jsp</result>
</action>
...

Snippet of login.jsp
================
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
<s:head theme="ajax" />
<title><s:text name="title.login"/></title>
<script type="text/javascript">
function submitForm()
{
        document.loginForm.submit();
}
</head>
<body >
...
<s:form name="loginForm" action="doLogin_retPassword" theme="simple">
<table>
....
<%
        /**
         * default form action "doLogin_retPassword" by passes validation:-
         * We will change to use default action when "Login" is pressed .
         * By default, we need to have the form action to not do any 
validation. Otherwise, any other modified action 
         * (eg. having javascript to change the form action's value) will all 
have login's validation associated with it, regardless
         * of struts.xml 's configured "validation.excludeMethods" param values 
for those actions.
                        (eg. we could have entered in one email field in the 
login form 
                                 and pressed "forgot password" link, and we'd 
be brought back to the login screen with
                                 "password is required" validation error).
         */
%>
......
                                       <!-- the login button -->
                                        <td><s:submit id="loginButton" 
type="button"
                                                cssStyle="width: 70px;" 
value="%{getText('login')}" action="doLogin" /></td>

                                         ....
                                      <!-- the Retrieve password link -->
                                       <td><!-- use javascript here to make the 
href do a submit -->
                                        <!-- this is done because otherwise 
form values won't get passed in correctly if submit isn't used. -->
                                        <s:a href="Forgot_Password" 
id="retPassword" cssClass="small" onclick="submitForm(); return false;">
                                                <s:text name="forgotpassword" />
                                        </s:a></td>

                                        .......
                                       <!-- register link -->
                                        <td><s:a href="doLogin_register.action" 
id="register" cssClass="small" onclick="submitForm();">
                                                <s:text name="notyetregistered" 
/>
                                        </s:a></td>
                                        ........
                                        <!-- the register button, next to the 
register link -->
                                        <td><s:submit type="button" 
value="%{getText('register')}"  action="doLogin_register" /></td>

                                          .....


> IE 6 redirects to wrong action/page
> -----------------------------------
>
>                 Key: WW-2851
>                 URL: https://issues.apache.org/struts/browse/WW-2851
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: Windows Server 2003
> IE 6.0 (tried 2 versions of IE: 6.0.3790.0, 6.0.3790.1830)
>            Reporter: Maria Kan
>
> In struts.xml, login button is tied to LoginAction, however it sometimes goes 
> into another action/page, RegisterAction/register_new_user.jsp.
> The page works fine with FireFox and IE 7, but not IE 6.
> Snippet of struts.xml
> =================
> <action name="doLogin_*" 
> class="com.dds.paymentgateway.pgweb.enduser.actions.LoginAction" method="{1}">
>                       <interceptor-ref name="defaultStack">
>                               <!-- These are methods invoked from buttons on 
> the login page. No validation needed. -->
>                               <param 
> name="validation.excludeMethods">input,register,gotoFirstPage,retPassword,reloadPrepaid</param>
>                       </interceptor-ref>
>                       <result name="input">/WEB-INF/pages/login.jsp</result>
>                       <result name="success" 
> type="redirect-action">reloadPrePaidUser_input</result>
>                       <result name="register" 
> type="redirect-action">register_input</result>
>                       <result name="ret_pw" 
> type="redirect-action">retrievePassword_input</result>
>                       <result name="reload_pp" 
> type="redirect-action">reloadPrePaidUser_inputFromLogin</result>
> </action>
> <action name="register_*" 
> class="com.dds.paymentgateway.pgweb.enduser.actions.RegisterAction" 
> method="{1}">
>                       <interceptor-ref name="defaultStack">
>                       <param 
> name="validation.excludeMethods">input,populate,empty</param>
>                       </interceptor-ref>
>                       <interceptor-ref name="myToken">
>                               <param 
> name="excludeMethods">input,populate,empty</param>
>                       </interceptor-ref>
>                       <result 
> name="input">/WEB-INF/pages/register_new_user.jsp</result>
>                       <result name="success" 
> type="redirect-action">doLogin_input</result>
>                       <result 
> name="invalid.token">/WEB-INF/pages/register_new_user.jsp</result>
> </action>     
> <action name="retrievePassword_*" 
> class="com.dds.paymentgateway.pgweb.enduser.actions.RetrievePasswordAction" 
> method="{1}">
>                       <interceptor-ref name="defaultStack" />
>                       <interceptor-ref name="myToken">
>                               <param name="excludeMethods">input</param>
>                       </interceptor-ref>
>                       <result name="success" 
> type="redirect-action">doLogin_input</result>
>                       <result 
> name="input">/WEB-INF/pages/retrieve_password.jsp</result>
>                       <result 
> name="invalid.token">/WEB-INF/pages/retrieve_password.jsp</result>
> </action>
> ...
> Snippet of login.jsp
> ================
> <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
> <%@ taglib prefix="s" uri="/struts-tags" %>
> ...
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
> "http://www.w3.org/TR/html4/loose.dtd";>
> <html>
> <head>
> <s:head theme="ajax" />
> <title><s:text name="title.login"/></title>
> <script type="text/javascript">
> function submitForm()
> {
>       document.loginForm.submit();
> }
> </head>
> <body >
> ...
> <s:form name="loginForm" action="doLogin_retPassword" theme="simple">
> <table>
> ....
> <%
>       /**
>        * default form action "doLogin_retPassword" by passes validation:-
>        * We will change to use default action when "Login" is pressed .
>        * By default, we need to have the form action to not do any 
> validation. Otherwise, any other modified action 
>        * (eg. having javascript to change the form action's value) will all 
> have login's validation associated with it, regardless
>        * of struts.xml 's configured "validation.excludeMethods" param values 
> for those actions.
>                       (eg. we could have entered in one email field in the 
> login form 
>                                and pressed "forgot password" link, and we'd 
> be brought back to the login screen with
>                                "password is required" validation error).
>        */
> %>
> ......
>                                        <!-- the login button -->
>                                       <td><s:submit id="loginButton" 
> type="button"
>                                               cssStyle="width: 70px;" 
> value="%{getText('login')}" action="doLogin" /></td>
>                                          ....
>                                       <!-- the Retrieve password link -->
>                                        <td><!-- use javascript here to make 
> the href do a submit -->
>                                       <!-- this is done because otherwise 
> form values won't get passed in correctly if submit isn't used. -->
>                                       <s:a href="Forgot_Password" 
> id="retPassword" cssClass="small" onclick="submitForm(); return false;">
>                                               <s:text name="forgotpassword" />
>                                       </s:a></td>
>                                         .......
>                                        <!-- register link -->
>                                         <td><s:a 
> href="doLogin_register.action" id="register" cssClass="small" 
> onclick="submitForm();">
>                                               <s:text name="notyetregistered" 
> />
>                                       </s:a></td>
>                                         ........
>                                         <!-- the register button, next to the 
> register link -->
>                                       <td><s:submit type="button" 
> value="%{getText('register')}"  action="doLogin_register" /></td>
>                                           .....

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to