• 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

where is best place to put jsp folder in web app

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am wondering where is best place to put jsp folder in web app. some says it should me project root dir , some says in web-inf, some says that private jsps should be in project root dir and and public jsps should be in web-inf.

i search on net but could find the proper ans.
so I want to know from you all. Pl help me

regards,
Nishita
 
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nishita,


1)public jsps should be in project root dir and and private jsps should be in WEB-INF.
2) you can use the projectRoot/jsp/*.jsp

I thinking their is a confusion on the first point because you wrote the vice-versa of what i have written.

If it's so remember one thing the contents inside your WEB-INF are private and hence cannot be publicly accessed unlike the projectRoot folder.
 
Nishita Jain
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the reply.
so that means private jsps should be in Web-inf. but want to ask 1 more thing. About the src folder. i search on net and found that src folder should in root dir and not in web-inf. even though in some project i have seen that src on web-inf.
I think its wrong. what you say?

Thanking you,
Nishita
 
subodh gupta
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See its not about your src folder what you need is your class file folder which is always inside your WEB-INF so dont bother about that and all the examples i have gone through had their src in projectRoot.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i have seen that src on web-inf.


I think that this is bad practice. You should leave source files outside WEB-INF. Leave in WEB-INF what should be deployed on the server. Source files are not deployed, so should be left out of this directory. Make a source directory somewhere else, like in the root.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Generally src folder falls in root directly and it is used to contains all java source file used in our web application.

For JSP pages we are using jsp directory in root to contains all jsp files..
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ashok Mor:
Generally src folder falls in root directly and it is used to contains all java source file used in our web application.



I'd say that the Java sources files should be kep out of the installation folder altogether - not in the root directory, either. Only put those files that are needed for deployment into the server directory hierarchy, and keep everything else safely out of it.
[ July 27, 2007: Message edited by: Ulf Dittmer ]
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The main reason being the 'src' folder present inside the WEB-INF or the source files present inside 'WEB-INF/classes' is easy to deal with after compiling as by default the compilation puts the .class files in the same directory where the source files are present.

This is what i have read during my initial period of study and have seen some applications following this strategy, which is very bad practice as others said.

Though you may feel easy while testing by doing the development on the deployment arena, sometimes its vulnerable to potential losses in case of a crash.

A good practice as Ulf suggested is to keep your development and deployment environments separate.
 
Ashok Mor
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:


I'd say that the Java sources files should be kep out of the installation folder altogether - not in the root directory, either. Only put those files that are needed for deployment into the server directory hierarchy, and keep everything else safely out of it.

[ July 27, 2007: Message edited by: Ulf Dittmer ]



Yes we should kept them safe, but what happen in defalut configuration the SRC folder saved in root directory, so what we can do is at the time of deployment we can remove src folder from root directory, and deploy the code.
 
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
Two things:

First, there is no such thing as 'web-inf' or 'Web-inf'.
It is always 'WEB-INF'. The misspelling of this directory has caused a lot of headaches for beginners so I always point it out when I see it.

Your source files don't need to be anywhere within your web application. They are not used or needed by the container to run your app.
Some containers (Resin is one I can think of off the top of my head) have an auto-compile feature. If you're using one of those conatainers and want to take advantage of that feature, check with its documentation to see where it looks for source files.
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Originally posted by Ben Souther:
First, there is no such thing as 'web-inf' or 'Web-inf'.
It is always 'WEB-INF'. The misspelling of this directory has caused a lot of headaches for beginners so I always point it out when I see it.



That's perfectly correct Ben.



[BPS: Edited to keep things friendly ]
[ July 27, 2007: Message edited by: Raghavan Muthu ]
[ July 27, 2007: Message edited by: Ben Souther ]
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Your source files don't need to be anywhere within your web application. They are not used or needed by the container to run your app.



What is the name for the class file called that contains the bytecode that was compiled from the source code?


TheFile.java is called a source file
TheFile.class is called ?

[ July 27, 2007: Message edited by: Nick Davenport ]
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


TheFile.java is called a source file
TheFile.class is called ?



Its in your earlier statement itself. Its called as 'class file'.
 
It is difficult to free fools from the chains they revere - Voltaire. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic