You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by g h <ge...@yesmate.com> on 2002/12/12 04:00:56 UTC

action to jsp form to action and validation failure problem.

Hi everyone,

Im new to structs so please be gentle.

I have an action that forwards onto a jsp page with a form.
When the form buttons are pressed a different action is called.

Action1 ---> testform.jsp ---> Action2

All works fine if the form passes validation.

When the form fails validation, I expect to be returned back to the
jsp form with some handy error messages. Instead all I get is a blank 
html page (<html><body></body></html>) and no error messages (and no 
errors from Jetty either).

Any clue what Im doing wrong?

Peter.


Attached is my source code, if anyone wants a look.




from my struts-config.xml
...

     <form-bean      name="testFormBean"
                     type="com.starjar.mint.webapp.TestForm">
     </form-bean>
...
     <!-- display the testform. -->
     <action    path="/displayTestFormBean"
                type="com.starjar.mint.webapp.actions.DisplayTestFormAction"
                name="testFormBean"
                validate="false"
             >
         <forward name="success" path="/WEB-INF/TestForm.jsp" />
         <forward name="failure" path="/index.jsp"/>
     </action>


     <!-- when one of the submit buttons on the form is pressed this action
          is called. with the property 'form_action' set according to 
which button
          was pressed
     -->
     <action    path="/processTestFromAction"
                type="com.starjar.mint.webapp.actions.ProcessTestFromAction"
                name="testFormBean"
                validate="true"
                input="/WEB-INF/TestForm.jsp"
                parameter="form_action"
             >
         <forward name="success" path="/index.jsp" />
         <forward name="failure" path="/WEB-INF/TestForm.jsp"/>
     </action>
...





Re: action to jsp form to action and validation failure problem.

Posted by Rick Reumann <ma...@reumann.net>.
 
> > Im new to structs so please be gentle.
> > 
> > I have an action that forwards onto a jsp page with a form.
> > When the form buttons are pressed a different action is called.
> > 
> > Action1 ---> testform.jsp ---> Action2
> > 
> > All works fine if the form passes validation.
> > 
> > When the form fails validation, I expect to be returned back to the
> > jsp form with some handy error messages. Instead all I get is a
> > blank html page (<html><body></body></html>) and no error messages
> > (and no errors from Jetty either).
> > 
> > Any clue what Im doing wrong?
> > 

Not exactly sure, although I've gotten similar blank pages before. 
Double check that you have the input="somejsp.jsp" in your action
mapping in the struts-config.xml. Use a debugger or put a print on the
top of the jsp page to see if you are even being returned to the
correct page if validation produces errors. (If all you are getting as
you show above then you probably aren't). 

-- 

Rick

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: action to jsp form to action and validation failure problem.

Posted by James Mitchell <jm...@telocity.com>.
On Wed, 2002-12-11 at 22:00, g h wrote:
> Hi everyone,
> 
> Im new to structs so please be gentle.
> 
> I have an action that forwards onto a jsp page with a form.
> When the form buttons are pressed a different action is called.
> 
> Action1 ---> testform.jsp ---> Action2
> 
> All works fine if the form passes validation.
> 
> When the form fails validation, I expect to be returned back to the
> jsp form with some handy error messages. Instead all I get is a blank 
> html page (<html><body></body></html>) and no error messages (and no 
> errors from Jetty either).
> 
> Any clue what Im doing wrong?
> 
> Peter.
> 


What's probably happening is an error is occuring that is being
swallowed (at some point) and leaves you puzzled as to its origin. 

This has happened to me on occasion, and if a detailed search through my
container's logs doesn't turn up anything, then its time to add more
(strategically placed) debug statements to my code.  That's always
helped me out of whatever mess I've created.

--
James Mitchell


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>