wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes web application directory structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "web application directory structure" Watch "web application directory structure" New topic
Author

web application directory structure

Shajid Johnny
Ranch Hand

Joined: May 15, 2010
Posts: 34
dear forum members,
I intend to start my j2ee building a simple project which will have jsp & servlets. I've tried both Netbeans & Eclipse but they maintain different directory structure. that confused me. i don't understand where actually to put the source files, jsp files, & servlets.
*If I want to create a new project without any help of any IDE, what should I do?
*should I put both the 'src' & 'pages' folders into the WEB-INF ?
*where should I put the 'classes' folder? inside the WEB-INF or inside the 'build' folder?
*what if I don't create any 'build' folder? what's its purpose?
*do I have to write 'build.xml' or the IDE will later create it?

lots of questions but desperate for the answers. It will be so generous of you if you write the answers right here without referring to any link.

Thanks in advance
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

Shajid Johnny wrote:*If I want to create a new project without any help of any IDE, what should I do?

That's a pretty vague question with no real answer. Set up a folder structure that suits you best.

*should I put both the 'src' & 'pages' folders into the WEB-INF ?
No. The sources are not part of the web app and shouldn't be anywhere within the web app.

*where should I put the 'classes' folder? inside the WEB-INF or inside the 'build' folder?
When creating the web app the class files need to end up in WEB-INF/classes. Whether they are temporarily built into some build folder or not is moot.

*what if I don't create any 'build' folder? what's its purpose?
A build folder is customarily used as an intermediate location for the build artifacts such as class files. Its use is entirely up to you.

*do I have to write 'build.xml' or the IDE will later create it?
I thought you said you weren't going to use an IDE? Which is it? Are you going to use one or not?

write the answers right here without referring to any link.
Please don't post things like this in the future. Telling people how to answer your questions is rude and will not make people want to help you. Sometimes a link is most appropriate. Why should people copy stuff that's already been answered elsewhere?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Shajid Johnny
Ranch Hand

Joined: May 15, 2010
Posts: 34
Dear Mr Bear Bibeault
I apologize for the mess that I created with my vague questions.
I am new to forum, & your suggestions will surely help me in future.

regarding using IDE- I think what I wanted is- first building the directory structures with my own (by creating new folders), and then import that into Eclipse.

actually- after creating a new Dynamic Web Project in Eclipse- the structure was:

myproject
--WebContent
------META_INF
------WEB-INF
--build
--src
--WebPages (I created this folder & placed a jsp page here)
------welcomeJsp.jsp
--index.html


but in the index.html I wrote <a href="/WebPages/welcomeJsp.jsp">Welcome Jsp</a>
but after running, if I click the link on the index page, the resource is not found.

I may sound dumb, it might be some silly mistake but i can't figure it out.

Thanks a lot
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

Shajid Johnny wrote:regarding using IDE- I think what I wanted is- first building the directory structures with my own (by creating new folders), and then import that into Eclipse.

Bad idea. If you are going to use an IDE, you should use the project structure that the IDE wants to create. Otherwise, you'll just spend all your time fighting with the IDE instead of writing useful code.
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 513

actually- after creating a new Dynamic Web Project in Eclipse- the structure was:

myproject
--WebContent
------META_INF
------WEB-INF
--build
--src
--WebPages (I created this folder & placed a jsp page here)
------welcomeJsp.jsp
--index.html

but in the index.html I wrote <a href="/WebPages/welcomeJsp.jsp">Welcome Jsp</a>
but after running, if I click the link on the index page, the resource is not found.


In the above folder structure, only what are all the things inside webcontent, will go into the war file, so you need to create WebPages inside WebContent, if you want the <a href="/WebPages/welcomeJsp.jsp">Welcome Jsp</a> to work...


Regards, Prasad
SCJP 5 (93%)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: web application directory structure