RE: Newbie question: Can anything cause the controller servlet to set the ActionForm bean twice
Hey Neil! Can you update me on the Struts' transaction token handling? What exactly is Struts' transaction token handling? TIA, Kunal -Original Message- From: Neil Erdwien [mailto:[EMAIL PROTECTED] Sent: Wednesday, 21 April 2004 06:59 To: Struts Users Mailing List Subject: Re: Newbie question: Can anything cause the controller servlet to set the ActionForm bean twice I've seen cases where a user accidentally double-clicks on the submit button and submits the form twice in quick succession. Struts' transaction token handling can prevent multiple submissions from being processed. However, I think this would happen after the ActionForm has been populated, so may not fix the problem you're seeing. Perpetual Newbie wrote: > Hi, > > I had an error that I have not been able to replicate ... and am hence > vague on the specifics. > It occured twice on different systems on different days before I had > debugging statements inline. > > It appears that the ActionForm bean was set twice (after a post) before > any other processing occured. > > With this limited information, has anyone seen something similar ? Or > perhaps what might be the root cause or what might trigger it. > > After this, the action called the validate() manually where an exception > was thrown ... (possibly because of null values set during the second > set). > > -- > Thanks, > pnewbie > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- Neil Erdwien, [EMAIL PROTECTED], Web Technologies Manager Computing and Network Services, Kansas State University - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie question: Can anything cause the controller servlet to set the ActionForm bean twice
On Tue, 20 Apr 2004, Hubert Rabago wrote: Thanks for the response. Have included the relevant sections. I realize it may take some effort to go through this. Thanks in advance for all the effort. pnewbie > It would help if you post your mapping as well as the code in the action > which deals with form processing, validation, and error handling. > Without seeing anything, I could guess that maybe: > a) Your input="url" points to another Struts action, in which case validate() > might be called again depending on the mapping > b) Your points to another Struts action, in which case validate() > might be called again depending on the mapping > c) Your user hit submit twice upon submitting a form > d) Your user got the error page after a validation failure and instead of > correcting the mistake, hit refresh instead to resubmit the form 1. I was the user on both occassions.(Was manually testing) 2. Did not hit it twice. (In any case tried to hit it twice later to replicate error to no avail.) 3. The very same steps succeed every time except on those two occassions. a. And some javascript that sets action to 'save' b. // else if(action.equals("save")) { CaseStudiesDetailForm detailForm =(CaseStudiesDetailForm)form; ActionErrors actErrors = detailForm.validate(mapping,req); if(!actErrors.isEmpty()) { saveErrors(req,actErrors); return mapping.findForward("editPage"); } CaseStudyService service = new CaseStudyService(); System.out.println("before calling the upload the file"); // Note: On these two occassions (only), ... "before calling the upload the file" was not printed out in catalina.out c. Exception handling (Unfortunately ... the exception thrown was a NullPointer at: if(e.getMessage().startsWith("errors.")) The actual error was lost. // catch(Exception e) { if(e.getMessage().startsWith("errors.")) { errors1.add(ActionErrors.GLOBAL_ERROR,new ActionError(e.getMessage())); } } // d. catalina.out Note that the pattern is repeated after 12 lines. In the logs the only two times this happened were when this error occured. Hence the suspicion that the form values were set twice. CASE ID SELECTED ::54 ***act.getPath() ::/case_studies_detail.jsp in get other sections2 in get other sections1 in get related offerings1 in get related offerings2 in get other sections2 in get other sections0 in get related offerings1 in get related offerings2 in get related offerings0 in get other sections0 in get related offerings0 in get other sections1 in get other sections2 in get other sections1 in get related offerings1 in get related offerings2 in get other sections2 in get other sections0 in get related offerings1 in get related offerings2 in get related offerings0 in get other sections0 in get related offerings0 in get other sections1 [WARN] RequestProcessor - -Unhandled Exception thrown: class java.lang.NullPointerException e. The only two ActionForm methods that print to stdout: Got this from a friend :Rather than using nested, use a get before the name of a bean that contains other beans within it and return the inner bean. This has been working fine all along. public RelatedOfferingsBean getRelOffId(int i) { System.out.println("in get related offerings"+i); return (RelatedOfferingsBean)relatedOfferingsList.get(i); } public OtherCaseSectionBean getOtherSecId(int i) { System.out.println("in get other sections"+i); return (OtherCaseSectionBean)otherSectionList.get(i); } Thanks, pnewbie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie question: Can anything cause the controller servlet to set the ActionForm bean twice
I've seen cases where a user accidentally double-clicks on the submit button and submits the form twice in quick succession. Struts' transaction token handling can prevent multiple submissions from being processed. However, I think this would happen after the ActionForm has been populated, so may not fix the problem you're seeing. Perpetual Newbie wrote: Hi, I had an error that I have not been able to replicate ... and am hence vague on the specifics. It occured twice on different systems on different days before I had debugging statements inline. It appears that the ActionForm bean was set twice (after a post) before any other processing occured. With this limited information, has anyone seen something similar ? Or perhaps what might be the root cause or what might trigger it. After this, the action called the validate() manually where an exception was thrown ... (possibly because of null values set during the second set). -- Thanks, pnewbie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Neil Erdwien, [EMAIL PROTECTED], Web Technologies Manager Computing and Network Services, Kansas State University - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie question: Can anything cause the controller servlet to set the ActionForm bean twice
It would help if you post your mapping as well as the code in the action which deals with form processing, validation, and error handling. Without seeing anything, I could guess that maybe: a) Your input="url" points to another Struts action, in which case validate() might be called again depending on the mapping b) Your points to another Struts action, in which case validate() might be called again depending on the mapping c) Your user hit submit twice upon submitting a form d) Your user got the error page after a validation failure and instead of correcting the mistake, hit refresh instead to resubmit the form --- Perpetual Newbie <[EMAIL PROTECTED]> wrote: > Hi, > > > > I had an error that I have not been able to replicate ... and am hence > > vague on the specifics. > > It occured twice on different systems on different days before I had > > debugging statements inline. > > > > It appears that the ActionForm bean was set twice (after a post) before > > any other processing occured. > > > With this limited information, has anyone seen something similar ? Or > > perhaps what might be the root cause or what might trigger it. > > > > After this, the action called the validate() manually where an exception > > was thrown ... (possibly because of null values set during the second > > set). > > > > -- > > Thanks, > > pnewbie > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __ Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25ยข http://photos.yahoo.com/ph/print_splash - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Newbie question: Can anything cause the controller servlet to set the ActionForm bean twice
Hi, I had an error that I have not been able to replicate ... and am hence vague on the specifics. It occured twice on different systems on different days before I had debugging statements inline. It appears that the ActionForm bean was set twice (after a post) before any other processing occured. With this limited information, has anyone seen something similar ? Or perhaps what might be the root cause or what might trigger it. After this, the action called the validate() manually where an exception was thrown ... (possibly because of null values set during the second set). -- Thanks, pnewbie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]