One form bean having form split into two different jsp pages
Joined: Apr 20, 2009
Hi, I am new to struts and really appreciate your help for this question.
Form bean contains: first name, last name, tuition fee
In jsp page 1, form1 contains fields: first name, last name
In jsp page 2, form2 contains field: tuition fee
In jsp page 3, form3 contains field:recurring fee
Action class1: populates form1 and submits it to DB
Action class2: populates form2 and submits it to DB
I have written separate action classes for inserting values from both forms to database but first name, last name, tuition fee, recurring fee all correspond to the same row in DB table even if they present in different forms.
When I am trying to submit form2 and form3, it is giving null pointer exception. (may be it is expecting all fields(first name, last name, tuition fee) in the same form instead of splitting it in two jsp pages??)
Is there any other way to handle this? My requirement is to split up input data( first name, last name, tuition fee etc.) in diffrent forms.(in different jsp's)
I am using struts 1.2 and Tomcat 5.5.25.
The form bean just contain get-set methods for all four fields.
I don't have the code available with me currently since it's in my office.Sorry about that but I haven't added any validations in form bean since I want to run basic functionality first.
It's giving me error when it goes to processAction2.do or processAction3.do saying null pointer exception.I think it's not able to populate all fields from form bean since the form is split up??
public class AnnualLoadAction2 extends Action
private static Logger log = Logger.getLogger(AnnualLoadAction2.class);
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
log.debug("inside action 2");
AnnualActionForm Form2 = (AnnualActionForm) form;
Annual anc=(Annual) request.getAttribute("anc");//get data entered in form 1 and add to that form 2 data to enter it in DB in one single row
catch (Exception e)
public class AnnualLoadAction3 extends Action
private static Logger log = Logger.getLogger(AnnualLoadAction3.class);
Please UseCodeTags. Turning up the logging level may help with the stack trace; I don't know of any excpetion swallowing--are you sure you're looking in the right log file? Try other techniques like using log statements--it's going to be really hard to help if you can't tell us where the NPE occurs.
*PLEASE* show the configuration. I don't understand why you won't.