You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Aapo Laakkonen <aa...@projectcast.com> on 2001/07/24 15:22:18 UTC

Mappings, bloody mappings

I have problem... It might be in my understanding, but here it goes...

I have these mappings:

    <form-beans>
        <form-bean name="FundUpdateForm"
                   type="com.projectcast.sfundm.FundForm"/>
    </form-beans>

    <global-forwards>
        <forward name="funds"
                 path="/fundlist.do"/>
    </global-forwards>

    <action-mappings>
        <action path="/fundlist"
                type="com.projectcast.sfundm.FundListAction"
               scope="request">
            <forward name="success"
                     path="/WEB-INF/web/fundlist.jsp"/>
            <forward name="failure"
                     path="/WEB-INF/web/fundlist.jsp"/>
        </action>
        <action path="/editfund"
                type="com.projectcast.sfundm.FundSelectAction"
               scope="request">
            <forward name="success"
                     path="/WEB-INF/web/editfund.jsp"/>
            <forward name="failure"
                     path="/WEB-INF/web/editfund.jsp"/>
            <forward name="cancel"
                     path="/funds.do"/>
        </action>
        <action path="/updatefund"
                type="com.projectcast.sfundm.FundUpdateAction"
                name="FundUpdateForm"
               scope="request"
               input="/WEB-INF/web/editfund.jsp"
            validate="true">
            <forward name="success"
                     path="/editfund.do"/>
            <forward name="cancel"
                     path="/funds.do"/>
<!-- I have also tried this
            <forward name="cancel"
                     path="/fundlist.do"/>
-->
        </action>
    <action-mappings>

Then some explanation. I have fundlist action that displays all the funds,
ok. Then
when user selects one fund on the list struts executes editfund action and
gets all
needed information about that fund. Everything works correctly at this
point. Then
editfund.jsp has a form that has action mapped to updatefund action and also
has
an cancel button. If cancel button is pressed the updatefund action gets
executed,
am I right? Here is first two lines from UpdateAction class:

 if (isCancelled(request))
    return (mapping.findForward("cancel"));

Then it should go back to fundlist.do action, but all what I get is HTTP 400
Bad Request error. What I am doing wrong? Or should I do something
different to get the same results? And I'm running struts on Apache Test
Environment 3.2.1 for Visual Age 3.5.3.

Thanks,
Aapo Laakkonen

-- Aapo Laakkonen, +358 (50) 33 99 682, ProjectCast Ltd, Helsinki, Finland.


Re: Mappings, bloody mappings

Posted by Rakesh <ay...@india.com>.
I am sorry I guess U need to keep the '/web' intact.
try this

<action-mappings>
        <action path="/fundlist"
                type="com.projectcast.sfundm.FundListAction"
               scope="request">
            <forward name="success"
                     path="/web/fundlist.jsp"/>
            <forward name="failure"
                     path="/web/fundlist.jsp"/>
        </action>



 Rakesh Ayilliath
(Software Engineer)

Synergy IT Innovations Pvt Ltd,
#196, 1st Floor, 9th Cross,
HMT Layout, RT Nagar
Bangalore 560032

ayilliath@india.com
www.ayilliath.8m.com
----- Original Message -----
From: "Aapo Laakkonen" <aa...@projectcast.com>
To: <st...@jakarta.apache.org>
Sent: Tuesday, July 24, 2001 6:52 PM
Subject: Mappings, bloody mappings


> I have problem... It might be in my understanding, but here it goes...
>
> I have these mappings:
>
>     <form-beans>
>         <form-bean name="FundUpdateForm"
>                    type="com.projectcast.sfundm.FundForm"/>
>     </form-beans>
>
>     <global-forwards>
>         <forward name="funds"
>                  path="/fundlist.do"/>
>     </global-forwards>
>
>     <action-mappings>
>         <action path="/fundlist"
>                 type="com.projectcast.sfundm.FundListAction"
>                scope="request">
>             <forward name="success"
>                      path="/WEB-INF/web/fundlist.jsp"/>
>             <forward name="failure"
>                      path="/WEB-INF/web/fundlist.jsp"/>
>         </action>
>         <action path="/editfund"
>                 type="com.projectcast.sfundm.FundSelectAction"
>                scope="request">
>             <forward name="success"
>                      path="/WEB-INF/web/editfund.jsp"/>
>             <forward name="failure"
>                      path="/WEB-INF/web/editfund.jsp"/>
>             <forward name="cancel"
>                      path="/funds.do"/>
>         </action>
>         <action path="/updatefund"
>                 type="com.projectcast.sfundm.FundUpdateAction"
>                 name="FundUpdateForm"
>                scope="request"
>                input="/WEB-INF/web/editfund.jsp"
>             validate="true">
>             <forward name="success"
>                      path="/editfund.do"/>
>             <forward name="cancel"
>                      path="/funds.do"/>
> <!-- I have also tried this
>             <forward name="cancel"
>                      path="/fundlist.do"/>
> -->
>         </action>
>     <action-mappings>
>
> Then some explanation. I have fundlist action that displays all the funds,
> ok. Then
> when user selects one fund on the list struts executes editfund action and
> gets all
> needed information about that fund. Everything works correctly at this
> point. Then
> editfund.jsp has a form that has action mapped to updatefund action and
also
> has
> an cancel button. If cancel button is pressed the updatefund action gets
> executed,
> am I right? Here is first two lines from UpdateAction class:
>
>  if (isCancelled(request))
>     return (mapping.findForward("cancel"));
>
> Then it should go back to fundlist.do action, but all what I get is HTTP
400
> Bad Request error. What I am doing wrong? Or should I do something
> different to get the same results? And I'm running struts on Apache Test
> Environment 3.2.1 for Visual Age 3.5.3.
>
> Thanks,
> Aapo Laakkonen
>
> -- Aapo Laakkonen, +358 (50) 33 99 682, ProjectCast Ltd, Helsinki,
Finland.
>
>

Re: Mappings, bloody mappings

Posted by Aapo Laakkonen <aa...@projectcast.com>.
> The one you have marked as "also tried" looks all right though.

:-) ... I must be doing something weird because I got it to work. Thanks
for reply. I you have not replied to this, then I could have spend many
more hours figuring out whats the problem.

> I may be a typo, but your message mentioned an "UpdateAction", but the
> type specified is "FundUpdateAction". 

Yep, it was.

I really like this struts framework.


Re: Mappings, bloody mappings

Posted by Ted Husted <hu...@apache.org>.
All the local forwards I see refer to funds.do -- but I do not see an
ActionMapping for "funds". 

There is a forward for "funds", but that would not map to "funds.do"
internally.

The one you have marked as "also tried" looks all right though.

I may be a typo, but your message mentioned an "UpdateAction", but the
type specified is "FundUpdateAction". 

I'd also try running it under a development copy of Resin or Tomcat 4,
which may give you more information with the error message. 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/


Aapo Laakkonen wrote:
> 
> I have problem... It might be in my understanding, but here it goes...
> 
> I have these mappings:
> 
>     <form-beans>
>         <form-bean name="FundUpdateForm"
>                    type="com.projectcast.sfundm.FundForm"/>
>     </form-beans>
> 
>     <global-forwards>
>         <forward name="funds"
>                  path="/fundlist.do"/>
>     </global-forwards>
> 
>     <action-mappings>
>         <action path="/fundlist"
>                 type="com.projectcast.sfundm.FundListAction"
>                scope="request">
>             <forward name="success"
>                      path="/WEB-INF/web/fundlist.jsp"/>
>             <forward name="failure"
>                      path="/WEB-INF/web/fundlist.jsp"/>
>         </action>
>         <action path="/editfund"
>                 type="com.projectcast.sfundm.FundSelectAction"
>                scope="request">
>             <forward name="success"
>                      path="/WEB-INF/web/editfund.jsp"/>
>             <forward name="failure"
>                      path="/WEB-INF/web/editfund.jsp"/>
>             <forward name="cancel"
>                      path="/funds.do"/>
>         </action>
>         <action path="/updatefund"
>                 type="com.projectcast.sfundm.FundUpdateAction"
>                 name="FundUpdateForm"
>                scope="request"
>                input="/WEB-INF/web/editfund.jsp"
>             validate="true">
>             <forward name="success"
>                      path="/editfund.do"/>
>             <forward name="cancel"
>                      path="/funds.do"/>
> <!-- I have also tried this
>             <forward name="cancel"
>                      path="/fundlist.do"/>
> -->
>         </action>
>     <action-mappings>
> 
> Then some explanation. I have fundlist action that displays all the funds,
> ok. Then
> when user selects one fund on the list struts executes editfund action and
> gets all
> needed information about that fund. Everything works correctly at this
> point. Then
> editfund.jsp has a form that has action mapped to updatefund action and also
> has
> an cancel button. If cancel button is pressed the updatefund action gets
> executed,
> am I right? Here is first two lines from UpdateAction class:
> 
>  if (isCancelled(request))
>     return (mapping.findForward("cancel"));
> 
> Then it should go back to fundlist.do action, but all what I get is HTTP 400
> Bad Request error. What I am doing wrong? Or should I do something
> different to get the same results? And I'm running struts on Apache Test
> Environment 3.2.1 for Visual Age 3.5.3.
> 
> Thanks,
> Aapo Laakkonen
> 
> -- Aapo Laakkonen, +358 (50) 33 99 682, ProjectCast Ltd, Helsinki, Finland.

Re: Mappings, bloody mappings

Posted by Rakesh <ay...@india.com>.
try this

    <action-mappings>
        <action path="/fundlist"
                type="com.projectcast.sfundm.FundListAction"
               scope="request">
            <forward name="success"
                     path="/fundlist.jsp"/>
            <forward name="failure"
                     path="/fundlist.jsp"/>
        </action>

I guess you do not require the /WEB-INF/web




 Rakesh Ayilliath
(Software Engineer)

Synergy IT Innovations Pvt Ltd,
#196, 1st Floor, 9th Cross,
HMT Layout, RT Nagar
Bangalore 560032

ayilliath@india.com
www.ayilliath.8m.com



----- Original Message -----
From: "Aapo Laakkonen" <aa...@projectcast.com>
To: <st...@jakarta.apache.org>
Sent: Tuesday, July 24, 2001 6:52 PM
Subject: Mappings, bloody mappings


> I have problem... It might be in my understanding, but here it goes...
>
> I have these mappings:
>
>     <form-beans>
>         <form-bean name="FundUpdateForm"
>                    type="com.projectcast.sfundm.FundForm"/>
>     </form-beans>
>
>     <global-forwards>
>         <forward name="funds"
>                  path="/fundlist.do"/>
>     </global-forwards>
>
>     <action-mappings>
>         <action path="/fundlist"
>                 type="com.projectcast.sfundm.FundListAction"
>                scope="request">
>             <forward name="success"
>                      path="/WEB-INF/web/fundlist.jsp"/>
>             <forward name="failure"
>                      path="/WEB-INF/web/fundlist.jsp"/>
>         </action>
>         <action path="/editfund"
>                 type="com.projectcast.sfundm.FundSelectAction"
>                scope="request">
>             <forward name="success"
>                      path="/WEB-INF/web/editfund.jsp"/>
>             <forward name="failure"
>                      path="/WEB-INF/web/editfund.jsp"/>
>             <forward name="cancel"
>                      path="/funds.do"/>
>         </action>
>         <action path="/updatefund"
>                 type="com.projectcast.sfundm.FundUpdateAction"
>                 name="FundUpdateForm"
>                scope="request"
>                input="/WEB-INF/web/editfund.jsp"
>             validate="true">
>             <forward name="success"
>                      path="/editfund.do"/>
>             <forward name="cancel"
>                      path="/funds.do"/>
> <!-- I have also tried this
>             <forward name="cancel"
>                      path="/fundlist.do"/>
> -->
>         </action>
>     <action-mappings>
>
> Then some explanation. I have fundlist action that displays all the funds,
> ok. Then
> when user selects one fund on the list struts executes editfund action and
> gets all
> needed information about that fund. Everything works correctly at this
> point. Then
> editfund.jsp has a form that has action mapped to updatefund action and
also
> has
> an cancel button. If cancel button is pressed the updatefund action gets
> executed,
> am I right? Here is first two lines from UpdateAction class:
>
>  if (isCancelled(request))
>     return (mapping.findForward("cancel"));
>
> Then it should go back to fundlist.do action, but all what I get is HTTP
400
> Bad Request error. What I am doing wrong? Or should I do something
> different to get the same results? And I'm running struts on Apache Test
> Environment 3.2.1 for Visual Age 3.5.3.
>
> Thanks,
> Aapo Laakkonen
>
> -- Aapo Laakkonen, +358 (50) 33 99 682, ProjectCast Ltd, Helsinki,
Finland.
>
>