Hi All, I tried the struts_beer sample program,exactly the same way in the book page740.But it is not forwarding the request from form.jsp to servlet.In the address bar it is changing as SelectBeer.do,but it is showing the same form.jsp.Can anyone help how to debug about forwarding in this program?
I tried it.Still it is not working.In address box it is showing the SelectBeer.do after submit.But it is not showing result.jsp.It is same as form.jsp.
As it's taking you so long to solve, I've tried it myself. And it worked after correcting the above select. Did you restart the container after saving form.jsp ?
In address box it is showing the SelectBeer.do after submit.
This is not a problem.
But it is not showing result.jsp.It is same as form.jsp.
Please show your result.jsp.
kathir vel
Ranch Hand
Joined: Jul 03, 2007
Posts: 92
posted
0
I tried your code in form.It was working first.But second time just I opened that page.Again it is showing the same problem.
Originally posted by kathir vel: I tried your code in form.It was working first.But second time just I opened that page.Again it is showing the same problem.
The reason why it was so hard to troubleshoot was that your validate method was sending back an error, which causes the app to navigate back to the form page (as defined by the input attribut of your ActionMapping in the struts-config.xml file). Unfortunately, you apparently don't have an html:errors or html:messages tag in your form page to display the error and tell you what went wrong.
Your forwarding fails because validation is not passing. That's part of how Struts works. You need to get an html:errors tag set up properly on the form page or do something (like my previous recommendation) to understand when and why validation is failing. [ October 31, 2007: Message edited by: Marc Peabody ]
You need to get an html:errors tag set up properly on the form page or do something (like my previous recommendation) to understand when and why validation is failing.
That's right. I'm lamely assuming that a correct select would not generate any error, as all colors are in VALID_COLORS. But the System.out or the html:errors will help.