Google News
logo
JSP - Interview Questions
How can you avoid direct access to any jsp from the client browser?
We can place the file inside the WEB-INF directory as the WEB-INF directory can not be accessed in a web browser. We will also have to configure file details in web.xml. Following is the syntax to configure such JSP.
<servlet>
<servlet-name>Test</servlet-name>
<jsp-file>WEB-INF/test.jsp</jsp-file>
<init-param>
<param-name>test</param-name>
<param-value>Test Value</param-value>
</init-param>
</servlet>
    
<servlet-mapping>
<servlet-name>Test</servlet-name>
<url-pattern>/Test.do</url-pattern>
</servlet-mapping>
Advertisement