Solved

Struts Action vs DispatchAction

Posted on 2003-11-03
4
461 Views
Last Modified: 2007-12-19
I have a piece of code, and I'll post it if necessary, but I suspect this is a known issue.

Works great if I use an Action class that has an execute() method.

I refactored it so that instead it uses a DispatchAction method. I pass in a parameter that tells it to call a save() method in it.

It works, EXCEPT:

If the validate() method of the ActionForm fails, I still get sent back to the jsp page (because of an input= line in the action mapping) BUT the user's input is gone, and the html:error tags telling the user what he did wrong don't show anything.

Is there something broken about DispatchAction???
0
Comment
Question by:JavaWannaBee
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
Jim Cakalic earned 75 total points
ID: 9673878
Hmm. Do you have 'redirect="true"' in the forward?
0
 

Author Comment

by:JavaWannaBee
ID: 9675047
No. I added it and no change.

I mispoke on one thing.

It IS reloading the jsp page and the data the user entered. I notice the url loses the sessionid when it does that though.

What it is not doing is showing the html errors. I am going to double check that the message resource bundle is working, but it was before.
0
 

Author Comment

by:JavaWannaBee
ID: 9675859
Was a mapping resource issue. You get the points since you tried :-)
0
 
LVL 19

Expert Comment

by:Jim Cakalic
ID: 9678955
OK. Thanks -- although I feel as though I didn't earn them. :-)
Jim
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question