You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by John Byrne <jb...@gmail.com> on 2010/07/09 10:15:16 UTC

Problems with parsing html with servlet

Hi

Please find listed below thesituation with tomcat installation.  I can
deploy html pages via the manager service or
http://localhost/comlinks/mypage

The requested resource (/ukjava1900) is not available.

I list below the changes I have made to sotware.  Thank you for your
help in preious thread

Software used

jdk-6u21-windows-x64
tomcat-6.0.26


This is the start up log



09-Jul-2010 07:50:34 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performanc
e in production environments was not found on the java.library.path: C:\tomcat 6
.0\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\PROGRAM FILES
\jdk1.6.0_21\BIN
09-Jul-2010 07:50:34 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-80
09-Jul-2010 07:50:34 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 997 ms
09-Jul-2010 07:50:34 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
09-Jul-2010 07:50:34 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.26
09-Jul-2010 07:50:34 org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor host-manager.xml
09-Jul-2010 07:50:35 org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
09-Jul-2010 07:50:35 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory comlinks
09-Jul-2010 07:50:36 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
09-Jul-2010 07:50:36 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
09-Jul-2010 07:50:36 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
09-Jul-2010 07:50:36 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-80
09-Jul-2010 07:50:36 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
09-Jul-2010 07:50:36 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31  config=null
09-Jul-2010 07:50:36 org.apache.catalina.startup.Catalina start
INFO: Server startup in 2007 ms

************



conf\context.xml

<Context reloadable="true" privileged="true">

*********

webapps\comlinks\web-inf\web.xml

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   version="2.5">

  <display-name>Welcome to Tomcat</display-name>
  <description>
     Welcome to Tomcat
  </description>

  <servlet>
    <servlet-name>UkJava1900</servlet-name>
    <servlet-class>formprocessors.UkJava1900</servlet-class>
  </servlet>



  <servlet-mapping>
    <servlet-name>UkJava1900</servlet-name>
    <url-pattern>/UkJava1900</url-pattern>
  </servlet-mapping>

</web-app>


***********
webapps/conf/web.xml

<servlet>
        <servlet-name>default</servlet-name>
        <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
        <init-param>
            <param-name>listings</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

*********************

This is the first line in servlet uk1900java.java


package formprocessors;

*********

This is the form action

<FORM action=/ukjava1900

***********


Kind Regards

John

-- 
Mult-i-tel better by design.

http://www.multitel.co.uk

tel: 44(0)151 548 8122
fax: 44(0)709 210 1464
skype jcbyrne

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


Re: Problems with parsing html with servlet

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John,

On 7/9/2010 4:15 AM, John Byrne wrote:
> The requested resource (/ukjava1900) is not available.

[snip]

>   <servlet-mapping>
>     <servlet-name>UkJava1900</servlet-name>
>     <url-pattern>/UkJava1900</url-pattern>
>   </servlet-mapping>

As others have pointed out, your URL mapping and <form> action action
URL are of mismatched case. I believe this situation was also pointed
out the last time you were asking roughly the same question(s).

> This is the first line in servlet uk1900java.java
> 
> package formprocessors;

If your file is called uk1900java.java, the class should be
formprocessors.uk1900java, not formprocessors.Uk1900Java. Perhaps if you
are on Windows, the case of the filename is not important. As long as
the following file exists, you ought to be okay:

[yourwebapp]/WEB-INF/classes/formprocessors/Uk1900Java.class

> <FORM action=/ukjava1900

It seems the only problem you have in your setup is the case mismatch of
the form action and the URL mapping for your servlet. Pick the one you
like the best (with or without caps) and change the other. Another
option would be to map both the upper-case and lower-case versions to
the same servlet, though that seems a bit lazy.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkw3dmIACgkQ9CaO5/Lv0PDGYgCgm1tDb2tNuTyBIHdRLmFXvymR
BZcAn3K0SwHZHjvkG+mIdg3Yg9Vw/MVY
=n1Zb
-----END PGP SIGNATURE-----

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


Re: Problems with parsing html with servlet

Posted by John Byrne <jb...@gmail.com>.
Hi Mark

It is WEB-INF in my directory structure, apollogies.

John

On 9 July 2010 09:24, Mark Thomas <ma...@apache.org> wrote:
> On 09/07/2010 09:15, John Byrne wrote:
>> webapps\comlinks\web-inf\web.xml
>
> It is WEB-INF, not web-inf. Case matters.
>
> Mark
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>



-- 
Mult-i-tel better by design.

http://www.multitel.co.uk

tel: 44(0)151 548 8122
fax: 44(0)709 210 1464
skype jcbyrne

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


Re: Problems with parsing html with servlet

Posted by Mark Thomas <ma...@apache.org>.
On 09/07/2010 09:15, John Byrne wrote:
> webapps\comlinks\web-inf\web.xml

It is WEB-INF, not web-inf. Case matters.

Mark



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


Re: Problems with parsing html with servlet

Posted by John Byrne <jb...@gmail.com>.
Hi Andre

Did not receive response to original post. Inability to evoke a
response for output from servlet located on tomcat after parseing a
html form? Details in original post.

On 9 July 2010 09:38, John Byrne <jb...@gmail.com> wrote:
> Mult-i-tel better by design.
>
> http://www.multitel.co.uk
>
> tel: 44(0)151 548 8122
> fax: 44(0)709 210 1464
> skype jcbyrne
>



-- 
Mult-i-tel better by design.

http://www.multitel.co.uk

tel: 44(0)151 548 8122
fax: 44(0)709 210 1464
skype jcbyrne

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


Re: Problems with parsing html with servlet

Posted by John Byrne <jb...@gmail.com>.
Hi Andre

The message did get through, apologies for the error.

John

On 9 July 2010 09:27, André Warnier <aw...@ice-sa.com> wrote:



-- 
Mult-i-tel better by design.

http://www.multitel.co.uk

tel: 44(0)151 548 8122
fax: 44(0)709 210 1464
skype jcbyrne

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


Re: Problems with parsing html with servlet

Posted by André Warnier <aw...@ice-sa.com>.
I seem to recall that you have already been told this several times, but just to remind you :

"/ukjava1900" is NOT equal to "/UkJava1900"

  like in

 > <FORM action=/ukjava1900
versus
 >     <url-pattern>/UkJava1900</url-pattern>

In addition, you have also been told already that proper HTML requires that tag attribute 
values be quoted, like in

<FORM action="/ukjava1900">


John Byrne wrote:
> Hi
> 
> Please find listed below thesituation with tomcat installation.  I can
> deploy html pages via the manager service or
> http://localhost/comlinks/mypage
> 
> The requested resource (/ukjava1900) is not available.
> 
> I list below the changes I have made to sotware.  Thank you for your
> help in preious thread
> 
> Software used
> 
> jdk-6u21-windows-x64
> tomcat-6.0.26
> 
> 
> This is the start up log
> 
> 
> 
> 09-Jul-2010 07:50:34 org.apache.catalina.core.AprLifecycleListener init
> INFO: The APR based Apache Tomcat Native library which allows optimal performanc
> e in production environments was not found on the java.library.path: C:\tomcat 6
> .0\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\PROGRAM FILES
> \jdk1.6.0_21\BIN
> 09-Jul-2010 07:50:34 org.apache.coyote.http11.Http11Protocol init
> INFO: Initializing Coyote HTTP/1.1 on http-80
> 09-Jul-2010 07:50:34 org.apache.catalina.startup.Catalina load
> INFO: Initialization processed in 997 ms
> 09-Jul-2010 07:50:34 org.apache.catalina.core.StandardService start
> INFO: Starting service Catalina
> 09-Jul-2010 07:50:34 org.apache.catalina.core.StandardEngine start
> INFO: Starting Servlet Engine: Apache Tomcat/6.0.26
> 09-Jul-2010 07:50:34 org.apache.catalina.startup.HostConfig deployDescriptor
> INFO: Deploying configuration descriptor host-manager.xml
> 09-Jul-2010 07:50:35 org.apache.catalina.startup.HostConfig deployDescriptor
> INFO: Deploying configuration descriptor manager.xml
> 09-Jul-2010 07:50:35 org.apache.catalina.startup.HostConfig deployDirectory
> INFO: Deploying web application directory comlinks
> 09-Jul-2010 07:50:36 org.apache.catalina.startup.HostConfig deployDirectory
> INFO: Deploying web application directory docs
> 09-Jul-2010 07:50:36 org.apache.catalina.startup.HostConfig deployDirectory
> INFO: Deploying web application directory examples
> 09-Jul-2010 07:50:36 org.apache.catalina.startup.HostConfig deployDirectory
> INFO: Deploying web application directory ROOT
> 09-Jul-2010 07:50:36 org.apache.coyote.http11.Http11Protocol start
> INFO: Starting Coyote HTTP/1.1 on http-80
> 09-Jul-2010 07:50:36 org.apache.jk.common.ChannelSocket init
> INFO: JK: ajp13 listening on /0.0.0.0:8009
> 09-Jul-2010 07:50:36 org.apache.jk.server.JkMain start
> INFO: Jk running ID=0 time=0/31  config=null
> 09-Jul-2010 07:50:36 org.apache.catalina.startup.Catalina start
> INFO: Server startup in 2007 ms
> 
> ************
> 
> 
> 
> conf\context.xml
> 
> <Context reloadable="true" privileged="true">
> 
> *********
> 
> webapps\comlinks\web-inf\web.xml
> 
> <web-app xmlns="http://java.sun.com/xml/ns/javaee"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>    version="2.5">
> 
>   <display-name>Welcome to Tomcat</display-name>
>   <description>
>      Welcome to Tomcat
>   </description>
> 
>   <servlet>
>     <servlet-name>UkJava1900</servlet-name>
>     <servlet-class>formprocessors.UkJava1900</servlet-class>
>   </servlet>
> 
> 
> 
>   <servlet-mapping>
>     <servlet-name>UkJava1900</servlet-name>
>     <url-pattern>/UkJava1900</url-pattern>
>   </servlet-mapping>
> 
> </web-app>
> 
> 
> ***********
> webapps/conf/web.xml
> 
> <servlet>
>         <servlet-name>default</servlet-name>
>         <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
>         <init-param>
>             <param-name>debug</param-name>
>             <param-value>0</param-value>
>         </init-param>
>         <init-param>
>             <param-name>listings</param-name>
>             <param-value>true</param-value>
>         </init-param>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
> 
> *********************
> 
> This is the first line in servlet uk1900java.java
> 
> 
> package formprocessors;
> 
> *********
> 
> This is the form action
> 
> <FORM action=/ukjava1900
> 
> ***********
> 
> 
> Kind Regards
> 
> John
> 


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


Re: Problems with parsing html with servlet

Posted by André Warnier <aw...@ice-sa.com>.
John Byrne wrote:
> Hi Mark, Andre et al
> 
> Sincere thanks for your expert help.  Pass on my help to your
> colleague who also helped.
> 
You are welcome, and we all read this list, so we don't need to copy eachother.
Now, did you do as told and is it now working, or what ?


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


Re: Problems with parsing html with servlet

Posted by John Byrne <jb...@gmail.com>.
Hi Mark, Andre et al

Sincere thanks for your expert help.  Pass on my help to your
colleague who also helped.


Kind Regards

John

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


Re: Problems with parsing html with servlet

Posted by Pid <pi...@pidster.com>.
On 09/07/2010 09:15, John Byrne wrote:
> Hi
> 
> Please find listed below thesituation with tomcat installation.  I can
> deploy html pages via the manager service or
> http://localhost/comlinks/mypage
> 
> The requested resource (/ukjava1900) is not available.
> 
> I list below the changes I have made to sotware.  Thank you for your
> help in preious thread
> 
> Software used
> 
> jdk-6u21-windows-x64
> tomcat-6.0.26
> 
> 
> This is the start up log
> 
> 
> 
> 09-Jul-2010 07:50:34 org.apache.catalina.core.AprLifecycleListener init
> INFO: The APR based Apache Tomcat Native library which allows optimal performanc
> e in production environments was not found on the java.library.path: C:\tomcat 6
> .0\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\PROGRAM FILES
> \jdk1.6.0_21\BIN
> 09-Jul-2010 07:50:34 org.apache.coyote.http11.Http11Protocol init
> INFO: Initializing Coyote HTTP/1.1 on http-80
> 09-Jul-2010 07:50:34 org.apache.catalina.startup.Catalina load
> INFO: Initialization processed in 997 ms
> 09-Jul-2010 07:50:34 org.apache.catalina.core.StandardService start
> INFO: Starting service Catalina
> 09-Jul-2010 07:50:34 org.apache.catalina.core.StandardEngine start
> INFO: Starting Servlet Engine: Apache Tomcat/6.0.26
> 09-Jul-2010 07:50:34 org.apache.catalina.startup.HostConfig deployDescriptor
> INFO: Deploying configuration descriptor host-manager.xml
> 09-Jul-2010 07:50:35 org.apache.catalina.startup.HostConfig deployDescriptor
> INFO: Deploying configuration descriptor manager.xml
> 09-Jul-2010 07:50:35 org.apache.catalina.startup.HostConfig deployDirectory
> INFO: Deploying web application directory comlinks
> 09-Jul-2010 07:50:36 org.apache.catalina.startup.HostConfig deployDirectory
> INFO: Deploying web application directory docs
> 09-Jul-2010 07:50:36 org.apache.catalina.startup.HostConfig deployDirectory
> INFO: Deploying web application directory examples
> 09-Jul-2010 07:50:36 org.apache.catalina.startup.HostConfig deployDirectory
> INFO: Deploying web application directory ROOT
> 09-Jul-2010 07:50:36 org.apache.coyote.http11.Http11Protocol start
> INFO: Starting Coyote HTTP/1.1 on http-80
> 09-Jul-2010 07:50:36 org.apache.jk.common.ChannelSocket init
> INFO: JK: ajp13 listening on /0.0.0.0:8009
> 09-Jul-2010 07:50:36 org.apache.jk.server.JkMain start
> INFO: Jk running ID=0 time=0/31  config=null
> 09-Jul-2010 07:50:36 org.apache.catalina.startup.Catalina start
> INFO: Server startup in 2007 ms
> 
> ************
> 
> 
> 
> conf\context.xml
> 
> <Context reloadable="true" privileged="true">
> 
> *********
> 
> webapps\comlinks\web-inf\web.xml
> 
> <web-app xmlns="http://java.sun.com/xml/ns/javaee"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>    version="2.5">
> 
>   <display-name>Welcome to Tomcat</display-name>
>   <description>
>      Welcome to Tomcat
>   </description>
> 
>   <servlet>
>     <servlet-name>UkJava1900</servlet-name>
>     <servlet-class>formprocessors.UkJava1900</servlet-class>
>   </servlet>
> 
> 
> 
>   <servlet-mapping>
>     <servlet-name>UkJava1900</servlet-name>
>     <url-pattern>/UkJava1900</url-pattern>
>   </servlet-mapping>
> 
> </web-app>
> 
> 
> ***********
> webapps/conf/web.xml
> 
> <servlet>
>         <servlet-name>default</servlet-name>
>         <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
>         <init-param>
>             <param-name>debug</param-name>
>             <param-value>0</param-value>
>         </init-param>
>         <init-param>
>             <param-name>listings</param-name>
>             <param-value>true</param-value>
>         </init-param>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
> 
> *********************
> 
> This is the first line in servlet uk1900java.java
> 
> 
> package formprocessors;

And what about the next few lines up to and including " ... extends
HttpServlet {"?


> *********
> 
> This is the form action
> 
> <FORM action=/ukjava1900

I'll repeat what André and others have said, just in case it wasn't
clear.  The form action MUST match the url-pattern element of the
Servlet you've defined in web.xml.

In web.xml:

  <url-pattern>/UkJava1900</url-pattern>

In your HTML page:
 <form action="/UkJava1900" method="... etc

               ^^^^^^^^^^^
               |||||||||||

(I've even aligned them so you can see it clearly)


p


(N.B. Your HTML style is archaic, would be a good idea to improve it).





> ***********
> 
> 
> Kind Regards
> 
> John
>