Hi I have a scenario where i have to put objects in session or request and assign the values to the input form fields if the object is not null: here is what is happeneing.
I have a master and detail form. The user inputs some information and and adds more information on the detail form linked to the master form, after input of detail the user comes back to the master form and submits the form.
What i want is that to store both the forms data into an object (formData bean) and when the user comes to master-form after choosing the details, the fields(onload) should be filled with the data user keyed earlier and not empty. here is my
JSP code and Javascript function.
<%formData=(FormData)session.getAttribute("formFields");%>
function onPageLoad(){
if("<%=formData%>"!="null"){
/// until here it works fine but than if its not null means the form is not new and there are values to bre retrieved from FormData Object.
var IdNo= "<%formData.getIdNo()%>";
// this is a method in FormData bean which returns the ID field value entered earlier. Now at this point it throws NullPointerException.
}
}
The first time when the jsp is loaded the formdata is null there obviously the method cannot be retrived which i m doing there so that i think is not the right way to do it.
Can someone plz help me out on how to populate the form fields from an object stored in session or request.
Thanks and regards
Gul