• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

.war Questions

 
Ranch Hand
Posts: 851
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think following link will help you
http://tomcat.apache.org/tomcat-5.5-doc/appdev/deployment.html
 
Farakh khan
Ranch Hand
Posts: 851
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 851
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
reply
    Bookmark Topic Watch Topic
  • New Topic