• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

dispatch and redirect-action

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use

**********************

<action name="viewOrder" class=".." ..>
<result name="success" type="dispatch">getOrder</result>
</action>

<action name="getOrder" class=".." ..>
<result name="success">/jsp/getOrder.jsp</result>
</action>
**********************

It works fine with http://../viewOrder?custId=..

But it fails when I use

*************************
<action name="viewOrder" class=".." ..>
<result name="success" type="redirect-dispatch">getOrder</result>
</action>

<action name="getOrder" class=".." ..>
<result name="success">/jsp/getOrder.jsp</result>
</action>
******************************

it shows me action "getOrder is not mapped this time.

Don't know what mistake I made.


 
FY Hsieh
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
correct -- when I used

type="chain"

it worked, and when I used

type="redirect-action"

it failed.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the *exact* error message you're getting? What's the stack trace? Have you checked your configuration using the config-browser plugin?
 
FY Hsieh
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:What is the *exact* error message you're getting? What's the stack trace? Have you checked your configuration using the config-browser plugin?



The error message is always the same ---

org.apache.struts2.dispatcher.Dispatcher serviceAction Could not find action or result
There is no Action mapped for action name xxxx

where "xxxx" is the action I want to use redirect-action to redirect to

I have already defined the action and it should be fine because if I call that action "xxxx" directly it works fine.

Another thing is --- if I change the type to "redirect" and use the FULL path in <result type="redirect"> http://localhost:80/app/xxx.action </result> it works. But whenver I change the full path to the action name itself it always shows me "There is no Action mapped for the action.."
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As per my understanding

YOu trying to call action class which extends DispatchAction.

I am new to struts I was doing doing like

I have a hidden variable like
in Struts config file you need to provide parameter="do" in the corresponding action.

or you can call the javascript function to submit action like



thats all you need to do. It works for me let me know.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Jaisai Vijay: Wrong version of Struts.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What version of Struts 2 are you using? Are there any errors in the log on startup? I ask because as of Struts 2.1 the correct result type is "redirectAction" (not "redirect-action").
 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello David,

I am using Struts1.2 anyway I don't see any errors it perfectly works for me. If FY Hsieh is using different version I am sorry for that.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jaisai vijay wrote:I am using Struts1.2 anyway I don't see any errors it perfectly works for me. If FY Hsieh is using different version I am sorry for that.


I was asking the original poster for the Struts version--by looking at the configuration supplied by the original poster it's clear that you and he are using completely different versions.
 
FY Hsieh
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using struts 2. Actually I have tried both "redirectAction" and "redirect-action" They gave me the same error
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you checked your configuration using the config-browser plugin?

Have you turned logging up to DEBUG level and checked the logs on startup for errors?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic