• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Preventing html from direct access

 
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If i put a jsp file into web-inf and then try to call it from servlet,it is happening.But,if i am putting a html page into web-inf and if i am trying to call that from servlet,it is saying requested resource is not available.Any suggestions?
 
Sheriff
Posts: 67746
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
The term "call" has no meaning in this context. Do you mean that you are forwarding to the JSP and HTML resources?
 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes Bear,I meant forwarding only.
Actually,from servlet i am able to forward to html page and jsp page both.
Earlier,i was going from servlet to jsp through request dispatcher,then from jsp to other html on button clicking,so control was not going to that html page.
So,i have reached to a conclusion :
If we are going to other page(html or page) through button click,link click etc.,then other resource must be outside web-inf even if first resource is also inside web-inf.
Explanation:
IF,
web-inf/a.jsp--->web-inf/b.jsp, on button click we can't go to b.jsp,it has to be outside web-inf,if we want to access on button click.
Please tell me if i am accurate in my decision.
 
Bear Bibeault
Sheriff
Posts: 67746
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
Anything within WEB-INF cannot be directly accessed from the browser.
 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,
thanks for the reply.But suppose the case :

web-inf/a.jsp-->some servlet(b.class)
If this flow is working fine then why the case which i have posted earlier is not working fine.while both b.class(servlet) and b.jsp are in web-inf only.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, whenever I see this I point it out because I've seen people get hung up on it. The directory WEB-INF must always be spelled with upper case letters.
A directory named 'web-inf' has no special meaning in Java web application.
This happens enough that it is the textbook example used in:
http://faq.javaranch.com/java/AvoidRedHerrings

If you're saying here, that a.jsp is being allowed direct access to a browser (and the directory is really named "WEB-INF") I would tell you that you are wrong.

web-inf/a.jsp-->some servlet(b.class)


Nothing under WEB-INF is directly available to the web.
 
In the renaissance, how big were the dinosaurs? Did you have tiny ads?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic