I am having a jsp page with some form controls. Suppose, if I click on a radio button, it will transfer control to next jsp page and there I should be able to track which form has generated the request. And, depending on the form name again I have to forward the result of that jsp page to the previous page or any other jsp page.
In this situation when I am checking a radio button I am getting error saying
document.formname.hiddenfld.value is null or not object
What actually I planned is, if I am able to set the formname in the hidden field, I can getParameter of that hidden field in next field and check for it's value there and subsequently I can forward to corresponding jsp page. But it didn't work. What else can be done?
0x2B | ~0x2B
SCJD, SCJP 1.5, SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJA, IBM Test 150, 142, 700, 701, Oracle Test 1Z0-51
posted 13 years ago
Can you explain me clearly, how to send the action command from the form element to servlet. Any sample code is appreciated, as I am not good at using Servlets I have started using jsp/servlets few days back.
I am getting values into these 3 forms from the database using some controller JSP's by interacting with the Bean classes. I need some set of values to be displayed in all the 3 jsp pages. What I did during designing of my first form is I binded the database values to a session for use in any jsp page. I forwarded the controller jsp page to my main JSP. In that situation it was fine.
But during the design time of my 2nd jsp what I found was I need the same controller jsp to transfer the same set of values to the 2nd jsp also. Here I faced a problem, as I need to forward the controller JSP to both forms. Later I noticed that my 3rd form also needs some of the values from one of the controller jsp.
Here I am thinking of resolving it as, "Identifying the request generated by the form using it's FORM NAME and depending on the name of the form I want to forward the page to any of my 3 main forms".
Can u please suggest me how I can achieve this task.
What I was doing till now is to get values into a dropdown list box I am writing a bean class to get values from database, then I am writing a controller jsp where I am getting values from bean class stored into an arraylist which is then bind to a session object and then it is used in the Main JSP. Depending on the value selected in the listbox again I have to invoke another method from the bean class and get those values, even for this task I have a controller jsp which does the job and again it is bind in session object which is again used in my Main jsp, here after binding the arraylist values to a session I need to transfer control again to my Main JSP
Easier solution, put a hidden filed on the page with a value where you are at.
posted 13 years ago
Yes, I am using a hidden field and as I am aware of my form name I am directly passing it as the value to that hidden field. When I transfer control to a jsp page, I am retrieving the hidden field value there and comparing it with a string variable declared there with the hidden field value and transferring control to subsequent JSP page. Here my problem is that, I am able to transfer control to first <jsp:forward page="first.jsp"> page only, the rest are being ignored. What shall I do?
My code is:
Where hidden1 is the Hidden field which is declared in all the 3 forms with same name...