• 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

JSP,HTML pages should be outsite WEB-INF

 
Ranch Hand
Posts: 2925
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 157
1
Android MySQL Database Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 112
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...........
 
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
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.
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSP & HTML should be inside the WEB-INF
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
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

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.
reply
    Bookmark Topic Watch Topic
  • New Topic