• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

web application directory structure

 
Shajid Johnny
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Shajid Johnny
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 667
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic