File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes where is best place to put jsp folder in web app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "where is best place to put jsp folder in web app" Watch "where is best place to put jsp folder in web app" New topic
Author

where is best place to put jsp folder in web app

Nishita Jain
Ranch Hand

Joined: Mar 30, 2006
Posts: 97
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


Nishita
subodh gupta
Ranch Hand

Joined: Jul 23, 2007
Posts: 203
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.


http://subodh-gupta.blogspot.com
Nishita Jain
Ranch Hand

Joined: Mar 30, 2006
Posts: 97
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

Joined: Jul 23, 2007
Posts: 203
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.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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.


[My Blog]
All roads lead to JavaRanch
Ashok Mor
Ranch Hand

Joined: Jul 17, 2007
Posts: 44
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..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42263
    
  64
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 ]

Ping & DNS - my free Android networking tools app
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

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.


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Ashok Mor
Ranch Hand

Joined: Jul 17, 2007
Posts: 44
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.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344


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 ]
Nick Davenport
Greenhorn

Joined: Jul 27, 2007
Posts: 12

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

Joined: Apr 20, 2006
Posts: 3344


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


Its in your earlier statement itself. Its called as 'class file'.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: where is best place to put jsp folder in web app