tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Whitby" <ug82...@cs.bham.ac.uk>
Subject Re: Fw: Servlet problem
Date Tue, 21 Feb 2006 08:24:54 GMT
Oops, that's a major typo on my part.  It is meant to say:

  <servlet>
    <servlet-name>SearchServlet</servlet-name>
    <servlet-class>SearchServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>SearchServlet</servlet-name>
    <url-pattern>/searchitem.jsp</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>SearchServlet</servlet-name>
    <url-pattern>/searchmatch.jsp</url-pattern>
  </servlet-mapping>


Now ironically enough now I've done this change my servlet is acting even 
more silly.  When I type in searchmatch.jsp or searchitem.jsp into the 
address bar, it automatically sends me to the searchnone.jsp page.

So I'm guessing my code says I'm using forward and my words say I want to 
use redirect, is that correct?  If so what's the best way to change my code 
so that when I go to searchmatch.jsp/searchitem.jsp I don't get 
automatically redirected to searchnone.jsp as I am doing, only when I've 
pressed the button and no items have been found that match the search 
parameter.

Mark

----- Original Message ----- 
From: "Caldarale, Charles R" <Chuck.Caldarale@unisys.com>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Monday, February 20, 2006 11:30 PM
Subject: RE: Fw: Servlet problem


> From: Mark Whitby [mailto:ug82msw@cs.bham.ac.uk]
> Subject: Re: Fw: Servlet problem
>
> If nothing is found then it redirects the user to
> searchnone.jsp.  If an item or more than one item
> is found then the page will redirect to itemlist.jsp
> or matchlist.jsp

As a previous poster pointed out, there's a difference between redirect
(requiring a round trip to the client) and forward (a server-only
mechanism).  Which is it that you want to do?  (Your code says one
thing, your words another.)

> I have the mapping twice yes, once for searchitem.jsp and once for
> searchmatch.jsp, which both use the same servlet - SearchServlet.

  <servlet-mapping>
    <servlet-name>SearchServlet</servlet-name>
    <url-pattern>/searchmatch.jsp</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>SearchServlet</servlet-name>
    <url-pattern>/searchmatch.jsp</url-pattern>
  </servlet-mapping>

The above are your published mappings, copied and pasted from your
original message; these appear identical to me - both are for the
searchmatch.jsp pattern.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message