----- Original Message ----- From: "W Strater" <[EMAIL PROTECTED]>
To: <users@tomcat.apache.org>
Sent: Friday, June 13, 2008 5:06 PM
Subject: Hiding JSP Pages


I am trying to hide the JSP so they can only be accessed via a forward. I have been able to put them in a subdirectory of WEB-INF using other containers but have not been able to do that with Tomcat 5.5.

We are not using Struts but it is the same approach where our business
logic is servlet/action based and we only use JSP for presentation.

A common practice would be to put the JSP page in the root directory of the WAR like following:

/HelloWorld.jsp
/WEB-INF/web.xml
/WEB-INF/classes/HelloWorld.class

Mmmm no dont think so, that kinda looks like a mix between precompiled and JSP Anyway doesnt matter... and it maybe because I'm in a different IDE, doesnt work the same...

This would allow the user to access the JSP page through the servlet with http://localhost:8080/app/HelloWorld or directly with http://localhost:8080/app/HelloWorld.jsp.

I want to use to only be able to access the JSP page through the servlet and the directory of the WAR would like the following:

/WEB-INF/web.xml
/WEB-INF/classes/HelloWorld.class
/WEB-INF/jsp/HelloWorld.jsp

The HelloWorld servlet would use the JSP for presentation by forwarding to it using code like the fllowing:

RequestDispatcher dispatcher = request.getRequestDispatcher("
/WEB-INF/jsp/HelloWorld.jsp");

Rather use this mapping...
/META-INF/test/index.jsp

ie just put the JSP's into Meta_Inf
That will hide em and they'll still work...

Having said that, this is the first time I gave this a whiz... you're forwarding idea is actually just the MVC model, a good way to do it... But normally what I do is stick a little code in the JSP... ie I check the bean, or the URI... then redirect or give the user a little message.

Interesting question... thanks

I tested on NB... there it just amounted to dragging the jsp's to the META folder... done.

Have fun..

---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to