Again i face a problem and have tried out all possibilities to solve this....
my web.xml file is as follows:
The JSP code through which I am trying to retrive the init parameter is:
This JSP file is named as TestJsp.jsp.
The servlet TestServlet retrieves the value from the DD and displays it well. But when I try to retrive the value from the JSP i am not able to and get a null value. Where am i wrong? Is it the web.xml file where i am mistaken? Please help. [ November 12, 2008: Message edited by: Sudipto Shekhar ]
for http://localhost:8080/webappName/TestJsp.jsp, the init parameters will not be available. If you still want those init parameters with this URL, change the servlet-mapping url-pattern element in web.xml to 'TestJsp.jsp'. [ November 13, 2008: Message edited by: Marimuthu Madasamy ]
Ok i understood that.It worked. I have one more similar doubt. I have two JSP files, where in one i set the page scoped attribute and in the second I try to retrieve the value. The code are as follows:
The other jsp file TestAtt.jsp is as follows:
It prints null when i retrieve the value of the attribute. Where am I wrong? Please help. [ November 13, 2008: Message edited by: Sudipto Shekhar ]
Your attribute is set on the page scope. And not available to the other jsp. You need to set it on session scope or request scope. In the case of the latter, you will need to forward it to the other jsp via requestDispatcher.
Bosun (SCJP, SCWCD).
So much trouble in the world -- Bob Marley
Ok so page scope is for the particular page. In RequestDispatcher as far as i know the forwarded page is given the request and the response object,right? So from my JSP index.jsp, suppose, i forward the request and response object to another page , say TestAtt.jsp. So how will the forwarded page will get the pageContext attribute? And also we can use the pageContext to set and get the session-scoped or application scope or request scope attributes.how does those work? When pageContext is for the same page only then how does this work:
Any links too would be very helpful.
[ November 13, 2008: Message edited by: Sudipto Shekhar ] [ November 14, 2008: Message edited by: Sudipto Shekhar ]