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 <forward> 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. <html:form action="/casestudiesdetail" enctype="multipart/form-data" >
   <html:submit property="save" onclick="setAction('save')">
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]

Reply via email to