  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | JSP - A mailing list about Java Server Pages specification and reference | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | how to reference action to servlet | how to reference action to servlet 2004-05-12 - By karl
Back Hi With NetBeans IDE 3.3.1 templates created files and some changes to point out my question. If I call it in NetBeans with Tomcat 3.2 it is working - it finds HelloServletTest. Then I export a war-file to Tomcat 4.1. and call in the browser
" http : // localhost : 8080 / proj / index.html "
When the go-button is pressed an error message says: HTTP Status 404 type Status report message /proj/servlet/HelloServletTest description The requested resource (/proj/servlet/HelloServletTest) is not available. Apache Tomcat/4.1.27
I suppose this - action="servlet/HelloServletTest" - is wrong with the new tomcat, but I don't know better and I tried quite some time.
Thanks for your help Karl
$ jar tvf proj.war 2 Wed May 12 18:27:30 CEST 2004 META-INF/MANIFEST.MF 1764 Wed May 12 18:27:30 CEST 2004 HelloServletTest.class 262 Wed May 12 18:27:30 CEST 2004 index.html 1028 Wed May 12 18:27:30 CEST 2004 WEB-INF/web.xml 290 Wed May 12 18:27:30 CEST 2004 HelloTest.jsp
The other file HelloTest.jsp is showing correctly.
the index.html (form and input added) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <TITLE></TITLE> </HEAD> <BODY> <form name="form1" method="post" action="servlet/HelloServletTest"> <input type="submit" name="submit" value="go!"> </BODY> </HTML>
and the servlet file - this line added - out.println("<H1>Hello Servlet Test !!! </H1>"); /* * HelloServletTest.java * * Created on 12. Mai 2004, 18:15 */
import javax.servlet.*; import javax.servlet.http.*;
/** * * @(protected) karl * @(protected) */ public class HelloServletTest extends HttpServlet { /** Initializes the servlet. */ public void init(ServletConfig config) throws ServletException { super.init(config); } /** Destroys the servlet. */ public void destroy() { } /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * @(protected) request servlet request * @(protected) response servlet response */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { response.setContentType("text/html"); java.io.PrintWriter out = response.getWriter(); /* output your page here */ out.println("<html>"); out.println("<head>"); out.println("<title>Servlet</title>"); out.println("</head>"); out.println("<body>"); out.println("<H1>Hello Servlet Test !!! </H1>");
out.println("</body>"); out.println("</html>"); /* */ out.close(); } /** Handles the HTTP <code>GET</code> method. * @(protected) request servlet request * @(protected) response servlet response */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { processRequest(request, response); } /** Handles the HTTP <code>POST</code> method. * @(protected) request servlet request * @(protected) response servlet response */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { processRequest(request, response); } /** Returns a short description of the servlet. */ public String getServletInfo() { return "Short description"; } }
=========================================================================== To unsubscribe: mailto listserv@(protected) with body: "signoff JSP-INTEREST". For digest: mailto listserv@(protected) with body: "set JSP-INTEREST DIGEST".
Some relevant archives, FAQs and Forums on JSPs can be found at:
http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com
|
|
 |