You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Inamdar, Anil" <ai...@iso-ne.com> on 2007/03/14 14:31:51 UTC

[S2] Result Type Dispatcher problem

Hello,

I have a problem with the result type dispatcher when I try to dispatch
the success or error to another action. I get 404 error. This works fine
with result type chain.

Here is my configuration.

      <action name="TaskInsert"
              class="com.isone.struts.action.InsertDataAction">
         <result type="tiles"
name="success">sampleapp.examples.task.insert</result>
         <result name="error">TaskList.action</result>
      </action>
   
      <action name="TaskDoInsert"
              class="com.isone.struts.action.InsertDataAction"
              method="doInsert">
         <result name="input">TaskInsert</result>
         <result type="redirect-action" name="success">TaskList</result>
         <!--<result type="chain" name="error">TaskInsert</result> THIS
WORKS -->
	   <result name="error">TaskInsert.action</result> 
         <!--THIS DOES NOT WORK. I Tried everything. With and without
.action, and starting the action with a "/" --> 

      </action>

Am I doing something wrong. This seems very basic to be..

Thanks
Anil



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


RE: [S2] Result Type Dispatcher problem

Posted by "Inamdar, Anil" <ai...@iso-ne.com>.
This is how 
1. One action class and multiple methods in it (insert, Doinsert,
update, DoUpdate, list, search etc)
2. All the action mappings use this class and call the different methods
based on what is required.
3. The action mappings have additional parameters defined such as DAO,
Bean class etc that are used in the base action class to do the actual
processing. That way we don't keep creating multiple action classes.

We had to disable "/actionName!input.action" style since all our methods
are in one action and the access control to these methods is done via
the roles interceptor.

Using input is possible and we use it elsewhere in the application, but
there are some situations where I have to forward the error messages to
a different action.

Any reason why dispatch to an action wouldn't work?

Thanks
Anil



-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Wednesday, March 14, 2007 10:32 AM
To: Struts Users Mailing List
Subject: RE: [S2] Result Type Dispatcher problem

--- "Inamdar, Anil" <ai...@iso-ne.com> wrote:
> Yes I tried with "redirect-action" and it works. But
> I don't want a redirect as I lose my messages and 
> other data from the previous action

Oh, I didn't notice that you said that in your
original post.

The default result type is "redirect". I don't know as
you can redirect to an action w/o specifying
"redirect-action". 

Once you redirect, of course you're going to lose
request-scoped data.

The way you have your actions defined isn't how I
normally picture S2 flow working. Personally, I have a
single action defined for a datatype (in general,
anyway) and display the initial form via a
"/actionName!input.action" link (or you could use
wildcards, or whatever).

If there's a validation issue, it goes back to !input
by magic. If I have an error during execution (so my
form submission action is either the default, or I put
the method in the url like "/actionName!update.action"
or whatever) I add a message and return INPUT which
brings me back to my input (which in my case is a
tile).

That way I don't have to think about anything, it just
works. Is there a particular reason you've set up your
actions the way you have?

d.



 
________________________________________________________________________
____________
Bored stiff? Loosen up... 
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front

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


RE: [S2] Result Type Dispatcher problem

Posted by Dave Newton <ne...@yahoo.com>.
--- "Inamdar, Anil" <ai...@iso-ne.com> wrote:
> Yes I tried with "redirect-action" and it works. But
> I don't want a redirect as I lose my messages and 
> other data from the previous action

Oh, I didn't notice that you said that in your
original post.

The default result type is "redirect". I don't know as
you can redirect to an action w/o specifying
"redirect-action". 

Once you redirect, of course you're going to lose
request-scoped data.

The way you have your actions defined isn't how I
normally picture S2 flow working. Personally, I have a
single action defined for a datatype (in general,
anyway) and display the initial form via a
"/actionName!input.action" link (or you could use
wildcards, or whatever).

If there's a validation issue, it goes back to !input
by magic. If I have an error during execution (so my
form submission action is either the default, or I put
the method in the url like "/actionName!update.action"
or whatever) I add a message and return INPUT which
brings me back to my input (which in my case is a
tile).

That way I don't have to think about anything, it just
works. Is there a particular reason you've set up your
actions the way you have?

d.



 
____________________________________________________________________________________
Bored stiff? Loosen up... 
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front

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


RE: [S2] Result Type Dispatcher problem

Posted by "Inamdar, Anil" <ai...@iso-ne.com>.
Yes I tried with "redirect-action" and it works. But I don't want a
redirect as I lose my messages and other data from the previous action

Thanks
Anil 

-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Wednesday, March 14, 2007 09:56 AM
To: Struts Users Mailing List
Subject: Re: [S2] Result Type Dispatcher problem

--- "Inamdar, Anil" <ai...@iso-ne.com> wrote:
> <result name="error">TaskInsert.action</result> 
> <!--THIS DOES NOT WORK. I Tried everything.

Did you try:

<result name="error"
        type="redirect-action">
  TaskInsert
</result>

d.



 
________________________________________________________________________
____________
Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097

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


Re: [S2] Result Type Dispatcher problem

Posted by Dave Newton <ne...@yahoo.com>.
--- "Inamdar, Anil" <ai...@iso-ne.com> wrote:
> <result name="error">TaskInsert.action</result> 
> <!--THIS DOES NOT WORK. I Tried everything.

Did you try:

<result name="error"
        type="redirect-action">
  TaskInsert
</result>

d.



 
____________________________________________________________________________________
Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097

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