• Post Reply Bookmark Topic Watch Topic
  • New Topic

Save JSP in WEb-Inf  RSS feed

 
Trupti Mehta
Ranch Hand
Posts: 79
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

I wish to save jsp files like forgotPassword in Web-Inf/jspf folder. I have saved it, but can't access it. Can anybody help how do I access the file.

Thanks
 
Swastik Dey
Rancher
Posts: 1782
14
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per my knowledge if jsp is saved under web-inf it cant be accessed directly, you need url-mapping for this.
 
Dhruva Mistry
Ranch Hand
Posts: 67
Eclipse IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trupti Mehta wrote:
Hi,

I wish to save jsp files like forgotPassword in Web-Inf/jspf folder. I have saved it, but can't access it. Can anybody help how do I access the file.

Thanks


keep in the project-name folder only and provide the link to main jsp page
 
Surya Kant
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i agree with swastik..you have to provide mapping in your xml files(if your are using struts)
Directly you cant access it
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apart from that all, it is not WEb-Inf, also not Web-Inf and certainly not web-inf.

It is WEB-INF. http://faq.javaranch.com/java/AvoidRedHerrings
 
Trupti Mehta
Ranch Hand
Posts: 79
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

So why do you want to do this in the first place?
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Trupti Mehta
Ranch Hand
Posts: 79
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

Once again Thanks for helping me get the point.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!