Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP,HTML pages should be outsite WEB-INF  RSS feed

 
Monica Shiralkar
Ranch Hand
Posts: 886
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should JSP and HTML pages inside Web INF or Outsite WEB INF. I have seen some applications where JSP and HTML pages are kept inside web info too.
Generally java classes are inside SRC, web.xml is inside web-info.and JSP pages are in WEB Content.but can JSP be in web-inf too?
 
harshvardhan ojha
Ranch Hand
Posts: 157
1
Android Java MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everything outside WEB-INF is publicly available no authentication is applied on that, but all resources inside WEB-INF is secured. You can keep static pages outside WEB-INF and dynamic pages like profiles, accounts inside WEB-INF.
Please cross check i might be wrong.
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While it's true anything inside WEB-INF will produce a 404 error when accessed directly, this doesn't mean that JSP files within WEB-INF are not accessible at all. They can be included or forwarded to using JSTL and RequestDispatcher. You can also create a servlet-mapping for them.

Also, it's not 100% true that everything outside WEB-INF is publicly available without any authentication. That's true by default, but it's possible to specify a security constraint for any content.
 
Swetha Bhagavathula
Ranch Hand
Posts: 112
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
instead we can JSP and HTML files place it in a seperate folder parallel to WEB-INF...WEB-INF is private folder.. if I am not wrong...Also Servlets are placed inside WEB-INF\classes and they need compilation for every modifications done where as JSp and HTML files modifications are recognised by container automatically.......If am wrong please correct me...........
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is most proper to place JSP pages inside WEB-INF so that they are not directly access lie except through their page controllers. See this article for more info on proper web app structure.
 
BalaMurali dhar
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP & HTML should be inside the WEB-INF
 
Reeny Ubeja
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jsp,html should be outside the web-inf because server always looks for class files n web.xml inside the web-inf->classes folder....
 
BalaMurali dhar
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
whenever your creating a project this is the root directory create a project folder. Inside the Project folder create WEB-INF Folder, classes folder & Lib folder . Inside the classes folder you write java class. Inside the Lib you have to put jar file. Inside the WEB-INF you can put web.xml, JSP & HTML
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BalaMurali dhar wrote:JSP & HTML should be inside the WEB-INF

That is too simplistic and not correct.

Firstly, HTML files are almost always directly addressed -- as they have no active components they do not need a page controller. So HTML file are generally outside the WEB-INF.

JSPs, which should never be directly addressed, should be inside WEB-INF so that they must be accessed via their page controllers.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!