I am trying to implement JSP init parameters but i am getting the HTTP 404 error . Please help me out.
My DD(web.xml) has the following definition
My JSP is as follows:
My JSP is in a directory called jsp in my eclipse project. So, should i include the jsp in the <jsp-page> tag and specify the <jsp-page> value as /jsp/JspInitParamaters.jsp?
Also, my eclipse console is not printing out any messages.
When I access this JSP via the URL given in the <url-pattern> tag, i get an HTTP 404 error and when I access the JSP directly i am getting the parameter value as null. I am using Apache tomcat 6.0.29.
note: your context-root should be in the WebApplicationRoot
When I access this JSP via the URL given in the <url-pattern> tag, i get an HTTP 404 error
This just means that the page cannot be found, most probably caused by a wrong directory structure. Try to build a .war file by hand. You can use the following instructions: HowToCreateWebApplicationWithoutAnIDE
when I access the JSP directly i am getting the parameter value as null.
That is correct in order to get to the init parameters you should use the url-pattern in the servlet-mapping element.
Hey Frits, to answer your questions,
1) I am accessing http://localhost:8080/Servlets/JspInitParams.jsp as JspInitParams.jsp is what i have specified as the URL pattern in the servlet mapping.
2) I am using eclipse so, there should not be any issues with the directory structure. FYI i am using a dynamic web project.
3) Yes i tried doing it your way but still got the above exception with tomcat 7.0.12