Two Laptop Bag*
The moose likes Tomcat and the fly likes .war Questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark ".war Questions" Watch ".war Questions" New topic
Author

.war Questions

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 740
Question1:
I am very new to Java servlet and trying to learn deploying .war

1. /test/WEB-INF/classes/aa.java

import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class aa extends HttpServlet {


public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();

out.println("<h1>Hello Servlet Examples</h1>");
}
}

2. /test/WEB-INF/web.xml file
<web-app>
<servlet>
<servlet-name>aa</servlet-name>
<servlet-class>aa</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>aa</servlet-name>
<url-pattern>/servlet/aa</url-pattern>
</servlet-mapping>
</web-app>


3. I made simple /test/index.html file i.e.
<a href=/servlet/aa>Hello</a>

4. cd <tomcat home>/webapps/test/
jar -cvf ss.war *

5. started tomcat http://127.0.0.1:7070/ss
index.html appeared but when I clicked the link<a href=/servlet/aa>Hello</a> it says:
HTTP Status 404 - /servlet/aa

Please Note: when I copy pasted index.html and WEB-INF in ROOT then it works fine

Question2:
if we have to put our html files in httpdocs (apache) and Java files in tomcat then:
will we just put WEB-INF folder in .war file. right?

Thanks & best regards
Laxmikant Ruikar
Greenhorn

Joined: Nov 29, 2005
Posts: 23
I think following link will help you
http://tomcat.apache.org/tomcat-5.5-doc/appdev/deployment.html
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 740
Originally posted by Laxmikant Ruikar:
I think following link will help you
http://tomcat.apache.org/tomcat-5.5-doc/appdev/deployment.html


Thanks for your reply
I am going to read this URL but please let me know where I am wrong because being a begging it is difficult after reading first time that where am making mistake.

Certainly I'll try be best to find the solution in recommended URL but I again request to point out my mistake directly

Thanks again & best regards
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 740
Originally posted by Laxmikant Ruikar:
I think following link will help you
http://tomcat.apache.org/tomcat-5.5-doc/appdev/deployment.html


Thanks Laxmikant Ruikar,

This is really a good link to start
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: .war Questions