Java Mailing List Archive

http://www.junlu.com/

Google
Google
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
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
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 Source code of java.io.IOException {
      response.setContentType("text/html");
      java.io.PrintWriter Source code of 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 Source code of 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 Source code of 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

©2008 junlu.com - Jax Systems, LLC, U.S.A.