Hello Every body! I have a few doubts regarding the lifecycle methods of jsp. I request Jsp gurus to clarify them. 1 ) I have overridden jspInit() method in my jsp page. I have written this the declaration tags(<%! here %> ).My doubt is that this method should be called only once in the life cycle of the jsp page.But i had observed that this method is getting executed when ever that page is being requested( I put a System.out statement in that method). Please explain this concept. @) This is regarding the <jsp:forward>.When i am forwarding a requst from one jsp page to another the 'request' is not the same in the second page. I am not able to read the parameters received fron the first page.Explain me this. Thanx in advance clkanth.
OK... I'm no expert on JSPs but why are you overriding the init method of the JSP? It is improper (according to architecture model 2) to write much Java code in a JSP scriptlet and you're talking about overriding the init() method (of the generated servlet) right there on the JSP? Beats me! On question # "@": Is the forwarded page's scope "session" or at least "request"?
Tony Alicea Senior Java Web Application Developer, SCPJ2, SCWCD
Regarding your second question: @) This is regarding the <jsp:forward>.When i am forwarding a requst from one jsp page to another the 'request' is not the same in the second page. I am not able to read the parameters received fron the first page.Explain me this. I�m not sure whether you are expecting the parameters received by the first page to be available in the new page (they won't be), or if you have sent the parameters along from the first page to the new page using the <JSP:parm>. I haven�t had problems with this, so it all seems a bit strange. Sooooo, here�s a couple of thoughts: When the JSP container gets the request for a transfer to a new JSP page (as opposed to the other possible types of targets), it creates a new pageContext object, but the Request object and the Session object will remain the same. You can pass information to the new page by using the <jsp:parm name=�passingArg_1� and a value statement. The new program can get at this information by using the getParameter ( ), getParameterValues ( ), and getParameterNames ( ) methods. <!-- Pass control to jspTest1.JSP with passing arguments --> <html> <body> <jsp:forward page=�jspTest1.JSP� > <jsp:parm name=�passingArg_1� value=�ABC� /> <jsp:parm name=�passingArg_2 value=�XYZ� /> </body> </html>