JSP Rookie here.... I need help with what goes where
I am new (and I mean very new) to JSP and Apache /Tomcat. I have installed on my system
mod_jk 2.0.43.so (Apache/Tomcat connector)
All installed no problem. I have gone on the web to find some JSP tutorials and found 2. But they are a bit dated and refer to WEB-INF , jsp webapps folders that are in different locations from what was installed in the above releases.... (Tomcat) .
Each of these tutorials point to different WEB-INF folders as an example and it's confusing the hell out of me.
Based upon my versions listed above... can anyone help me out ????? All I would like is to know where the heck to put my files so I can run my stuff.
Hmm, the WEB-INF directory is located in your web apps directory root. Every web app has its own WEB-INF. So, if you make a web app called "myApp", then the directory structure would be something like
web accessible files go in the myApp dir (and any new directories you make under myApp). Servlets and beans go in the WEB-ING/classes dir. Jar files go in the lib dir.
Is there a dir in the tomcat install called "webapps"? That is where your web app will go. All new web apps can be dropped into this dir as long as they contain a WEB-INF dir with a web.xml file of their own. So in the above example we would have
Hope that helps.
so if I understand it. correctly:
Here is my Tomcat path:
Is MyApp under ROOT or WEB-INF????
and then the subdirectories under MyApp ???
or is it
No. ROOT should be the default webapp. You can add classes directly to the ROOT/WEB-INF/classes dir if you want.
However, if you make a NEW web app, then it goes in the webapps dir parallel to ROOT. You would also have to change the server.xml to specify another web app. This is the common way of adding new applications to an app server.
Adding a new web app:
In your WEB-INF you need a web.xml file that is respoinsible for telling the app server what servlets and such are loaded for this particular web app. Take a look at the web.xml that is in the ROOT/WEB-INF if there is one.
You access the ROOT web app by using the host name only. Requests to http://hostname/* will be serviced by the default app, ROOT int his case. If you added a new web app called myApp and set it up in your server.xml, then you would access it by the following url
When the app server got a request with myApp in the url, it would route it to that dir automatically. This make sense?
Remember that the url that is requested will not always map directly to the file system as it is laid out.
Okay I think I'm understanding now..... lemme try out my stuff an get back to ya.... the ROOT directory was confusing me because it had a
WEB-INF subdirectory... I understand the default(ROOT) logic you were mentioning..
Thanks for the insight... I'm sorry if I sound a bit dense on it, but this is my first JSP experience
I'll let ya know how it goes...
Remi - I'm still having problems..... it still wont find my .jsp file... if you wouldn't mind please
look at this link:
scroll down to the "A Simple JSP" sub heading about 3/4 way down.... I have followed these instructions and your directory guide. Now it calls to create a sub directory called "jsp"..... I'm gettin a bit more confused by this one.... sheesh
which I did but it still croaks with not being able to find the count.jsp file.... egads
Thanks very much
OK, the directions it is giving are misleading. According to the url's it is specifying, you should NOT make a 'jsp' dir. Put count.jsp in the sitepoint dir. The person who wrote that guide was confused, possibly about the preceding paragraph concerning the "examples" app they were talking about, which has a "jsp" dir. WEB-INF should be a subdir of sitepoint
Fantastic!!!!.. that worked... I see now where the wording was a bit misleading... I took his instruction to create another subdirectory called jsp where he was referring to the Sitepoint directory.... Thank you SO much!!!!
I have one more quick question: what do you use to create your JSP's???? I was toying with Eclipse, and then someone told me to use ANT (which I have never used)..... I guess I'm looking for something that has good Project Management , which will dump the right file (.jsp,.html, .xml ) files in the appropriate folder without alot of manual copying etc etc.....
Hmm, I use Websphere Studio Application Developer, which is based off of Eclipse. IBM made a jsp/servlet/J2EE portion for it which works greate. Eclipse does not have jsp support by default and there were no good jsp plugins for it when I was using it(6-8 months ago), but there may be now. Unfortunately, WSAD is sold by IBM and costs over a $1000 I believe.
I know that Suns Netbeans IDE has jsp/servlet support built in. It is free. You may want to try that.
Ant is a deployment/build tool. It is not an IDE for development. It is equivalent to 'make' in linux.
Last edited by Nemi; June 3rd, 2003 at 03:11 PM.
Thanks for the info and the help. I really appreciate it...
I gained insight into the J2EE directory structure through your replies. greatly appreciated.
You said "if you make a NEW web app, then it goes in the webapps dir parallel to ROOT"
Can we create a New Web app, which is not under webapps directory?
I read somewhere that we can set the following in the server.xml.
<Context path = "" docBase = "c:\myapp\" reloadable = "true"/> to actually achieve that.
I have tried it, and it does not work. Do you have any information on this?
I have not done this, sorry. I am familiar with the spec, but I use Websphere 3.5 in deployment and Websphere 5 for development.
This doc may help you. It says what you are trying should be possible. The only thing I can see that is different is that you are using backslashes in the path name instead of forward slashes as he has in his example.