Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Struts and the fly likes input result propagating to action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "input result propagating to action" Watch "input result propagating to action" New topic

input result propagating to action

Marco Garu

Joined: Jan 05, 2012
Posts: 3
Hello! I've got an issue i need to solve... i spent some time on it but i couldn't figure a solution!
Basically i've got a loadHome Action which loads some data from a DB and displays the result on the home page of my app. The homepage has no forms or anything, so i just specified a result name="success" for this loadHome Action.
Then i've got another page, suppose it's "form.jsp", where i can fill a form to submit some data, with a -validation file to validate the fields. This form.jsp page is also the "input" result for the submit action.
If i insert some wrong value in the form.jsp form and submit the data, the validation works correctly, it gives me back an "input" result and i correctly see the form.jsp page with all the validation error and messages. Now the problem is the following: if from this point (the input result of the submit action) i call the loadHome Action (suppose via a menu button) i get an error saying that my loadHome Action has no result named "input" in the struts.xml action definition. Now, i know what's the problem, but what i'm not expecting is that the loadHome action is redirecting to the home.jsp propagating the input result given by the form submit action!
I hope i made the situation clear enough!

Has anybody experienced this situation? Any help will be greatly appreciated!
ganapathi pudi

Joined: Apr 29, 2012
Posts: 10
Understanding of my knowledge .for calling loadHome action(another time/while not submit) with different method with same action . configure that action with another method specified your own results.
Marco Garu

Joined: Jan 05, 2012
Posts: 3
The logic flow is a bit different, i'll try to explain better here:

home.jsp page -> LoadFormPage action, result success -> formPage.jsp
formPage.jsp, i submit some wrong data which wont pass the validation -> SubmitForm action, result input -> formPage.jsp with field errors shown
formformPage.jsp with field errors shown -> LoadHome action (pressing a menu link to home) RESULT INPUT ->home.jsp

Now my point is, why is the result INPUT propagating to the LoadHome action? Being a redirect action i would expect a result SUCCESS!
I agree. Here's the link:
subject: input result propagating to action
It's not a secret anymore!