tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Whitby" <>
Subject Fw: Servlet problem
Date Mon, 20 Feb 2006 22:19:14 GMT
EDIT: I've sent this twice because the first one contained an error in what I wrote.  Ignore
the first one.

Hi all,

Apologies for the stupidity of this email but I'm having a few servlet problems.  I've created
the following file, compiled it into a class file using Netbeans then copied
the class file into my WEB-XML/classes file.  

Now for testing the servlet is very limited but when I try to run the jsp page the page is
redirected to http://localhost:8080/WEB-INF/classes/SearchServlet?itemvalue=type+search+criteria+here
and not /searchnone.jsp as specified.  When it's redirected to the first page though all I
get is my error.jsp page which is set up to catch 404 error pages as defined in my web.xml
page.  So it isn't finding something, what I don't know though.

Can anyone tell me where I'm going wrong?



<table width="100%"> 
 <p class="subhead">Item Search Page</p>
  Use this page to search through the different items that we stock.  All searches are done

key words.  If using multiple words please use a comma after every different word.</i>.
 <FORM ACTION="WEB-INF/classes/SearchServlet" METHOD="GET">
     <INPUT TYPE="TEXT" NAME="itemvalue" SIZE="100" VALUE="type search criteria here"><br>
 <a href="search.jsp">Return to the main search page</a>


import javax.servlet.*;
import javax.servlet.http.*;

public class SearchServlet extends HttpServlet {

    public void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        String address = "/searchnone.jsp";
        RequestDispatcher dispatcher = request.getRequestDispatcher(address);
        dispatcher.forward(request, response);
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);

    public String getServletInfo() {
        return "Short description";


<?xml version="1.0" encoding="ISO-8859-1"?>

"-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"

<web-app xmlns=""

Specifies the first page that users will come to in the system

Specifies the error page that will occur for 404 errors


Database connection test

      <description>DB Connection</description>


Specifies the security area within the system

            <web-resource-name>Secure Area</web-resource-name>


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message