Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I access a jsp page which is in WEB-INF folder?

 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody, I am chaitanya, I have a doubt, Using the deployment descriptor, I can access the classes in the classes folder under WEB-INF.

Consider a scenario, I have a folder named jsps under WEB-INF folder, not can I access the jsps. If I can do so, please tell me how to do that, should I configure anything in the deployment descriptor.

Please help me. Thank you all in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The whole purpose of putting JSPs under WEB-INF is to disallow directly addressing them. This is a good practice as the JSPs should only be available via their servlet controllers -- you can forward to JSPs under WEB-INF.

If that's not what you want, don't put them there.
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Bear, but how can I do that. Can you please give me an example or any reference.

Thank you in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need information on how not to put a file in a folder?

If you want to access a JSP directly (should be rare), don't put it in WEB-INF.
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:You need information on how not to put a file in a folder?

If you want to access a JSP directly (should be rare), don't put it in WEB-INF.


Thanks Bear, I want the information on how to access a webpage present in WEB-INF folder.

Thank you in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forward to the JSP from its page controller.
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Forward to the JSP from its page controller.


Thank you Bear, I will definitely try that one.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic