In web.xml, it is allowed to disable the invoker (that means call to
servlet file directly will be directed to other page). How can I do the same
for the
jsp page? For example, there's a page login.jsp. The following is
part of the web.xml:
<servlet>
<servlet-name>loginjsp</servlet-name>
<jsp-file>/login.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>loginjsp</servlet-name>
<url-pattern>/loginPage</url-pattern>
</servlet-mapping>
I expect that the page can be accessed by calling
http://localhost/loginPage only. I don't want people can access the page by
http://localhost/login.jsp So I have added the following details in the web.xml:
<servlet>
<servlet-name>redirectorservlet</servlet-name>
<servlet-class>RedirectorServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>redirectorservlet</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
The RedirectorServlet is used for redirect the page to another page.
However, in JBuilder, when I start the
tomcat server, it generates the
following contents in the web.xml and delete my above mapping :
<servlet>
<servlet-name>debugjsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>jspCompilerPlugin</param-name>
<param-value>com.borland.jbuilder.webserverglue.tomcat.jsp.JasperSunJavaComp
iler</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>debugjsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
Then how can I disable the call to jsp file directly?
Thanks!
Stephen