Surya Kant, please do not assume anyone who posts in the JSP forum is using Struts unless they say so.
Trupti Mehta wrote:
I am not using structs, I just want to keep some files hidden from the user - user can't access directly. So wanted to keep in web-inf. an you help me how to I add url-pattern in the web.xml.
Again, it's WEB-INF, not web-inf. Be accurate or be ignored!
What's the point of hiding the JSPs in WEB-INF if you are just going to map URLs directly to them anyways? It's a completely useless exercise. What's the motivation for wasting your time doing this and just making it more complicated?
The reason that most people hide JSPs in WEB-INF is to not allow direct access by any URL and to force access only to be through their page controllers.
First this question: why are you placing those files in WEB-INF while you actually want to access them directly? That's the only what clear is from this topic.
Do you after all want to place a servlet in between so that you can control the page access yourself? That solution should be straightforward enough. Map a servlet in web.xml and let it forward the request to the desired JSP. Lookup the page controller pattern.
Thanks to all of you. Yes their is no point in doing what I was doing. If I have to give url-pattern to acces the page, then the page can be accessible directly which makes no sense.
I just wanted to do so, I wanted to keep functional files seperately than index & other files. That's all my intentions were. But it is wrong, and I got it. If I am forwarding any special functional file within the Servlet & moving back or so, then it makes sense.