You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Randy Curnutt <rc...@sol-plus.com> on 2003/03/26 03:14:47 UTC
url-pattern problem? Deployed servlet works in Tomcat 4.0.4 but fails in Tomcat 4.1.18
I have a Servlet (with JSP's) which was created using NetBeans, and I did use the appropriate hierarchy.
When I run the servlet using the NetBeans Internal Tomcat version 4.0.4
the Servlet and JSP pages work fine. However, when I create a WAR file and let Tomcat do the Auto Deploy and
try to run under Tomcat 4.1.18 the servlet fails. The first page is just a JSP and it is displayed okay but it then posts to my Servlet and it immediately returns to the initial page. My error page is not displayed. I can't find anything in the log files.
It appears the problem might be related to the url-pattern.
In my web.xml file I have the following:
<servlet-mapping>
<servlet-name>SAWSServlet</servlet-name>
<url-pattern>/SAWSServlet</url-pattern>
</servlet-mapping>
Running Tomcat 4.0.4 from within netbeans the URL which it successfully posts to after the logon
screen looks as follows: http://localhost:8081/SAWSServlet?action=logon&UserId=test&Password=test
Under Tomcat 4.1.18 the URL which it tries to post to after logon has an extra "/" after the servlet name and
before the query string parameters: http://localhost:8080/SAWSServlet/?action=logon&UserId=test&Password=test
Can anyone explain why I'm getting the extra "/" after the sevlet name? I'm wondering if there is a setting in the server.xml or web.xml for the whole Tomcat install that is different in 4.1.18 than the Netbeans Internal version of Tomcat 4.0.4.
TIA for any help!
Randy
Re: url-pattern problem? Deployed servlet works in Tomcat 4.0.4 but fails in Tomcat 4.1.18
Posted by "Randal E. Curnutt" <rc...@sol-plus.com>.
I tried changing the URL Pattern as suggested below but that didn't fix
the problem. With regards to my code, I have a simple form in my JSP
which uses the "GET" method to send some form field values to my
servlet. I'll paste the code below.
<FORM action="/SAWSServlet" class="formClass" method="get" >
<INPUT type="HIDDEN" id="action" name= "action" value="logon">
<p>UserId: <INPUT type="TEXT" id="UserId"
name= "UserId" width="50"></p>
<p>Password: <INPUT type="PASSWORD" id="Password"
name= "Password" width="50"></p>
<p><INPUT type="SUBMIT" id="Submit" value="Logon" width="50"></p>
</FORM>
When I run this under Tomcat 4.1.18 there is an extra "/" inserted
between the action and the start of the query string. I don't have
this problem when running the exact same code in NetBeans using the
Internal Tomcat version 4.0.4. The incorrect URL which is generated
under Tomcat 4.1.18 is:
http://localhost:8080/SAWSServlet/action=logon&userId=test&password=test
Since the exact same code works in one version but fails in another
that makes me suspect that the problem is a configuration issue.
Any clue what could be making the URL different between the two
versions of Tomcat?
Thanks,
Randy
Quoting "Craig R. McClanahan" <cr...@apache.org>:
...
> > It appears the problem might be related to the url-pattern.
> > In my web.xml file I have the following:
> > <servlet-mapping>
> > <servlet-name>SAWSServlet</servlet-name>
> > <url-pattern>/SAWSServlet</url-pattern>
> > </servlet-mapping>
> >
> > Running Tomcat 4.0.4 from within netbeans the URL which it
> successfully posts to after the logon
> > screen looks as follows:
> http://localhost:8081/SAWSServlet?
action=logon&UserId=test&Password=test
> >
> > Under Tomcat 4.1.18 the URL which it tries to post to after logon
> has an extra "/" after the servlet name and
> > before the query string parameters:
> http://localhost:8080/SAWSServlet/?
action=logon&UserId=test&Password=test
> >
> > Can anyone explain why I'm getting the extra "/" after the sevlet
> name? I'm wondering if there is a setting in the server.xml or
> web.xml for the whole Tomcat install that is different in 4.1.18 than
> the Netbeans Internal version of Tomcat 4.0.4.
> > TIA for any help!
>
> Without seeing the code in your JSP page that generates the URL you
> are
> posting to, there is no way to know what's really going on. However,
> a
> workaround that will make Tomcat forward the "extra slash" URL to
> your
> servlet anyway would be to change the URL pattern to
> "/SAWSServlet/*"
> instead.
>
> > Randy
> >
>
> Craig
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: url-pattern problem? Deployed servlet works in Tomcat 4.0.4 but
fails in Tomcat 4.1.18
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Tue, 25 Mar 2003, Randy Curnutt wrote:
> Date: Tue, 25 Mar 2003 21:14:47 -0500
> From: Randy Curnutt <rc...@sol-plus.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
> Randy Curnutt <rc...@sol-plus.com>
> To: tomcat-user@jakarta.apache.org
> Subject: url-pattern problem? Deployed servlet works in Tomcat 4.0.4 but
> fails in Tomcat 4.1.18
>
> I have a Servlet (with JSP's) which was created using NetBeans, and I did use the appropriate hierarchy.
> When I run the servlet using the NetBeans Internal Tomcat version 4.0.4
> the Servlet and JSP pages work fine. However, when I create a WAR file and let Tomcat do the Auto Deploy and
> try to run under Tomcat 4.1.18 the servlet fails. The first page is just a JSP and it is displayed okay but it then posts to my Servlet and it immediately returns to the initial page. My error page is not displayed. I can't find anything in the log files.
> It appears the problem might be related to the url-pattern.
> In my web.xml file I have the following:
> <servlet-mapping>
> <servlet-name>SAWSServlet</servlet-name>
> <url-pattern>/SAWSServlet</url-pattern>
> </servlet-mapping>
>
> Running Tomcat 4.0.4 from within netbeans the URL which it successfully posts to after the logon
> screen looks as follows: http://localhost:8081/SAWSServlet?action=logon&UserId=test&Password=test
>
> Under Tomcat 4.1.18 the URL which it tries to post to after logon has an extra "/" after the servlet name and
> before the query string parameters: http://localhost:8080/SAWSServlet/?action=logon&UserId=test&Password=test
>
> Can anyone explain why I'm getting the extra "/" after the sevlet name? I'm wondering if there is a setting in the server.xml or web.xml for the whole Tomcat install that is different in 4.1.18 than the Netbeans Internal version of Tomcat 4.0.4.
> TIA for any help!
Without seeing the code in your JSP page that generates the URL you are
posting to, there is no way to know what's really going on. However, a
workaround that will make Tomcat forward the "extra slash" URL to your
servlet anyway would be to change the URL pattern to "/SAWSServlet/*"
instead.
> Randy
>
Craig
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org