Actually that's wrong and my jsp code was wrong but my servlet code was right for what I wanted.

I've solved the problem by replacing the ACTION command with "SearchItem" and then replacing /searchitem.jsp with /SearchItem in the web.xml file and that seems to have solved the problem fine. It's my fault for misunderstanding how things were processed.

Thanks for everyone's help again

Mark

----- Original Message ----- From: "Mark Whitby" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Tuesday, February 21, 2006 8:24 AM
Subject: Re: Fw: Servlet problem


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" <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to