Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to package a project and install in tomcat webapps?

 
Andrew Parker
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I built up an assignment with JSP and servlet. I am using JBuilder 6 and tomcat 4.
I put the assignment folder under webapps of tomcat and I added

to /conf/server.xml.
When I run http://localhost:8080/assignment/index.jsp, it can be displayed. However, the servlet classes cannot be found when I run the servlet functions.
I put all the servlet classes under /webapps/assignment/WEB-INF/classes/assignment/ folder.
I think that I set the path and docBase wrongly.
How should I set it?
Here is the java file:
package assignment;
public class StudentItem{
private int StudentID;
private String StudentName;
private double StudentGPA;
.....
}
All other jave files are under the package assignment.
All the compiled class files were put under JBuilder6/Tomcat4/webapps/assignment/WEB-INF/Classes/assignment/
e.g. StudentItem.class
Here is the jsp file:

All jsp files were put under
JBuilder6/Tomcat4/webapps/assignment/
The jsp page can display. However, jsp page cannot locate the class files.
http://localhost:8080/assignment/index.jsp - ok
If fill in the form and submit, it cannot locate the servlet:
http://localhost:8080/assignment/StudentItem
because it only dispatches to http://localhost:8080/StudentItem
The path with "assignment" is missed.
-----------------------------------------------
2nd question, I know how to use jar. , but how to use the war file? Where should be put it? Or, can I just put the assignment.war file without the whole assignment dir?
Can I put the war file under tomcat4/webapps in order to run that application?
What is the purpose of creating the war file?
just package the root directory?
Thanks for help
 
Andrew Parker
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found one thing that:
I have many jsp files under assignment folder. When I input localhost:8080/assignment/index.jsp, it is ok.
There are some link in index.jsp. If I click them, it will go to localhost:8080/add.jsp, but not localhost:8080/assignment/add.jsp.
It is the same with the servlet problem.
localhost:8080/servlet/StudentEntity, but not localhost:8080/assignment/servlet/StudentEntity
How should I configure in the web.xml about the servlet and jsp mapping? Is it related to this problem?
Also, if I put the war file under tomcat4/webapps in order to run that application, how can I do that? Do I just put assignment.war under tomcat4/webapps?
Thanks
 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi andrew
Have you made proper entries of servlets in web.xml file ??
Please check that out, else you will need to write the class name & alias name of the servlet in the web.xml
hth
MB
 
Andrew Parker
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you made proper entries of servlets in web.xml file ??
Sorry, what do you mean? Do you mean the web.xml under the assignment/WEB-INF?
I set it as follows and it returns an error when I started tomcat.


Could you tell me where could I find our the tutorial for web.xml?
Thanks
 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Andrew Parker:
Have you made proper entries of servlets in web.xml file ??
Could you tell me where could I find our the tutorial for web.xml?
Thanks

http://edocs.bea.com/wls/docs70/webapp/webappdeployment.html#1012209
HTH
MB
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic