I am using instances of my ActionForm for showing a list prior to showing
the detail. I do this because I don't want to duplicate the data
structures.
To better explain, I have an ActionForm called ProfileForm. I have a jsp
that uses ProfileForm to display and edit in the struts fashion.
To get to the edit jsp, I have a listing jsp. I used multiple instances of
the ProfileForm class to show 25 profiles at time. This actually done in my
ListProfileAction as such:
for ( int i = 0 ; rs.next() ; i++ ) {
profileEntry = new ProfileForm() ;
profileEntry.setServlet(getServlet()) ;
profileEntry.setProfileno(as.getInt("PROFILENO")) ;
try {
profileEntry.queryMaster(mapping, request) ;
} catch ( Exception e ) {
throw new ServletException("(ProfilForm): " + e.toString())
;
}
profileEntry.setSeq(Integer.toString(i % 2)) ;
profileEntry.setRecordStatus("QUERIED") ;
profileList.add(profileEntry) ;
}
I get a NullPointerException on the try/catch block. It appears to be
because the ProfileForm instance (which extends ActionForm) is not being
initialized correctly. Am I missing anything that will make an ActionForm
fully initialized?
I know this might look strange, but besides object reuse, another
implication here is to fully populate my forms before they're are shown in
detail. If this just isn't possible, I'll probably just try going about
this differently. But it'd be so cool to reuse my objects in this manner.
Anthony
It is by caffeine alone I set my mind in motion.
It is by the Beans of Java that thoughts acquire speed,
the hands acquire shaking, the shaking becomes a warning.
It is by caffeine alone I set my mind in motion.