• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Save JSP in WEb-Inf

 
Ranch Hand
Posts: 79
Android Java ME Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 67
Mac Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ME Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ME Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
permaculture is a more symbiotic relationship with nature so I can be even lazier. Read tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic