You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by jeffo1b <jo...@selectenergypartners.com> on 2010/09/14 21:47:04 UTC
Problem with ActionForward
I submit a very simple form to an action, the code in the action class finds
the appropriate forward, and then control is handed off to the framework.
no errors are generated, but i get a "File Download" popup window that asks,
"Do you want to save this file, or find a program online to open it? Name:
logon.do; Type: Unknown file type, 543 bytes; From: Localhost"
Here is the code:
//struts-config
<action-mappings>
<action
path="/logon"
type="com.sep.ebs.actions.LogonAction"
name="logonForm"
scope="request"
input="/pages/home.jsp"
unknown="false"
validate="false">
<forward
name="defaultData"
path="/default.do"
redirect="false" />
<forward
name="success"
path="/pages/Contracts.jsp"
redirect="false" />
<forward
name="failure"
path="/pages/home.jsp"
redirect="false" />
//home.jsp
<body>
<!--#include virtual="header.jsp" -->
<!--#include virtual="message.jsp" -->
<!--#include virtual="Menu.jsp" -->
<html:form action="logon.do">
Username: <html:text property="username"/><br/>
Password: <html:text property="password"/><br/>
<html:submit property="submit" value="Logon"
styleClass="searchButton"></html:submit>
</html:form>
//LogonAction
public ActionForward executeAppLogic(ActionMapping mapping, ActionForm
form,HttpServletRequest request, HttpServletResponse response)throws
Exception {
//check logon credentials
//some code
DefaultDataForm bean = getDefaultData(form);
request.setAttribute(EBSUtil.MESSAGE_BEAN, bean);
ActionForward forward = mapping.findForward("success");
return forward;
}
I am running this in Eclipse, and in the debugger, the value of the forward
at the end of my LogonAction has the correct mapping
("/pages/Contracts.jsp"). More confusing is that if I type in the url
(root/pages/Contracts.jsp), the page loads correctly. I just cant get the
Action class to send me there.
Any help would be greatly appreciated.
Jeff
--
View this message in context: http://old.nabble.com/Problem-with-ActionForward-tp29712329p29712329.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem with ActionForward
Posted by jeffo1b <jo...@selectenergypartners.com>.
Update: the jsp I am trying to load (Contracts.jsp) has 3 included files in
it. When I changed the forward mapping from ("/pages/Contracts.jsp") to one
of the included files ("/pages/message.jsp") it loaded correctly.
jeffo1b wrote:
>
> Also, I am using Struts 1.3.
>
> jeffo1b wrote:
>>
>> I submit a very simple form to an action, the code in the action class
>> finds the appropriate forward, and then control is handed off to the
>> framework. no errors are generated, but i get a "File Download" popup
>> window that asks, "Do you want to save this file, or find a program
>> online to open it? Name: logon.do; Type: Unknown file type, 543 bytes;
>> From: Localhost"
>>
>> Here is the code:
>>
>> //struts-config
>> <action-mappings>
>> <action
>> path="/logon"
>> type="com.sep.ebs.actions.LogonAction"
>> name="logonForm"
>> scope="request"
>> input="/pages/home.jsp"
>> unknown="false"
>> validate="false">
>> <forward
>> name="defaultData"
>> path="/default.do"
>> redirect="false" />
>> <forward
>> name="success"
>> path="/pages/Contracts.jsp"
>> redirect="false" />
>> <forward
>> name="failure"
>> path="/pages/home.jsp"
>> redirect="false" />
>>
>> //home.jsp
>> <body>
>> <!--#include virtual="header.jsp" -->
>> <!--#include virtual="message.jsp" -->
>> <!--#include virtual="Menu.jsp" -->
>> <html:form action="logon.do">
>> Username: <html:text property="username"/><br/>
>> Password: <html:text property="password"/><br/>
>> <html:submit property="submit" value="Logon"
>> styleClass="searchButton"></html:submit>
>> </html:form>
>>
>> //LogonAction
>> public ActionForward executeAppLogic(ActionMapping mapping, ActionForm
>> form,HttpServletRequest request, HttpServletResponse response)throws
>> Exception {
>>
>> //check logon credentials
>> //some code
>> DefaultDataForm bean = getDefaultData(form);
>> request.setAttribute(EBSUtil.MESSAGE_BEAN, bean);
>>
>> ActionForward forward = mapping.findForward("success");
>> return forward;
>> }
>>
>> I am running this in Eclipse, and in the debugger, the value of the
>> forward at the end of my LogonAction has the correct mapping
>> ("/pages/Contracts.jsp"). More confusing is that if I type in the url
>> (root/pages/Contracts.jsp), the page loads correctly. I just cant get
>> the Action class to send me there.
>>
>> Any help would be greatly appreciated.
>>
>> Jeff
>>
>
>
--
View this message in context: http://old.nabble.com/Problem-with-ActionForward-tp29712329p29713499.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem with ActionForward
Posted by jeffo1b <jo...@selectenergypartners.com>.
Also, I am using Struts 1.3.
jeffo1b wrote:
>
> I submit a very simple form to an action, the code in the action class
> finds the appropriate forward, and then control is handed off to the
> framework. no errors are generated, but i get a "File Download" popup
> window that asks, "Do you want to save this file, or find a program online
> to open it? Name: logon.do; Type: Unknown file type, 543 bytes; From:
> Localhost"
>
> Here is the code:
>
> //struts-config
> <action-mappings>
> <action
> path="/logon"
> type="com.sep.ebs.actions.LogonAction"
> name="logonForm"
> scope="request"
> input="/pages/home.jsp"
> unknown="false"
> validate="false">
> <forward
> name="defaultData"
> path="/default.do"
> redirect="false" />
> <forward
> name="success"
> path="/pages/Contracts.jsp"
> redirect="false" />
> <forward
> name="failure"
> path="/pages/home.jsp"
> redirect="false" />
>
> //home.jsp
> <body>
> <!--#include virtual="header.jsp" -->
> <!--#include virtual="message.jsp" -->
> <!--#include virtual="Menu.jsp" -->
> <html:form action="logon.do">
> Username: <html:text property="username"/><br/>
> Password: <html:text property="password"/><br/>
> <html:submit property="submit" value="Logon"
> styleClass="searchButton"></html:submit>
> </html:form>
>
> //LogonAction
> public ActionForward executeAppLogic(ActionMapping mapping, ActionForm
> form,HttpServletRequest request, HttpServletResponse response)throws
> Exception {
>
> //check logon credentials
> //some code
> DefaultDataForm bean = getDefaultData(form);
> request.setAttribute(EBSUtil.MESSAGE_BEAN, bean);
>
> ActionForward forward = mapping.findForward("success");
> return forward;
> }
>
> I am running this in Eclipse, and in the debugger, the value of the
> forward at the end of my LogonAction has the correct mapping
> ("/pages/Contracts.jsp"). More confusing is that if I type in the url
> (root/pages/Contracts.jsp), the page loads correctly. I just cant get the
> Action class to send me there.
>
> Any help would be greatly appreciated.
>
> Jeff
>
--
View this message in context: http://old.nabble.com/Problem-with-ActionForward-tp29712329p29712375.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org