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/01 11:48:50 UTC

Re: Tomcat 6.0.26

Hi Shay

Still having problems with reading html form with servlet.

We only have a small number of servlets and would choose not to place
them in a package at this point in time.

I understand your naming of package com.company.project, can you
replace com\mycompany\Myservlet.class. What is the link between them.

I noted your comment on web.xml file  Have been using tomcat for 3/4
years and have most probably got away with murder using invoker
servlet and mapping of.

I attach a file with html form action, server start up log, web.xml
file and error http 404

We only have a small number of servlets and would choose not to place
them in a package at this point in time.

I understand your naming of package com.company.project, can you
replace com\mycompany\

On 28 June 2010 13:26, Shay Rojansky <ro...@roji.org> wrote:
> Hi John.
>
> Both John and I were right... Moving your directory outside ROOT was the
> first step.
>
> Now, in your web.xml, the <servlet-class> element is wrong. It should
> contain a servlet class that should be found under your WEB-INF/classes
> directory. So if you want to reference the class that you have under
> comlinks\WEB-INF\classes\com\mycompany\MyServlet.class, simply put
> "com.mycompany.MyServlet" in the <servlet-class> element.
>
> By the way, it's hard to tell what your class name and package actually are.
> It's a good idea to follow conventions and place it in a package called
> com.company.project
>
> Shay
>
> On Mon, Jun 28, 2010 at 5:11 AM, John Byrne <jb...@gmail.com> wrote:
>
>> Hi Shay
>>
>> copy of directory structure
>>
>> C:\Tomcat 6.0\webapps\comlinks\WEB-INF\classes>
>>
>> I have changed this it incorporate your suggestions.
>>
>> I attach a copy of web.xml
>>
>> many thanks for your help.
>>
>> Kind Regards
>>
>> John
>>
>> On 27 June 2010 15:54, Shay Rojansky <ro...@roji.org> wrote:
>> > John,
>> >
>> > Can you please send your web.xml as well? I would be it's a misconfigured
>> > <servlet> in there (the WEB-INF should not be part of the class package
>> > name, as it appears in your error log).
>> >
>> > Shay
>> >
>> > On Sun, Jun 27, 2010 at 7:55 AM, John Byrne <jb...@gmail.com>
>> wrote:
>> >
>> >> Hi
>> >>
>> >> Have installed tomcat 6.0.26 on windows 7.
>> >>
>> >> Have installed jdk1.6.0_20 to use with tomcat
>> >>
>> >> The javac and java commands both give correct response at dos prompt.
>> >>
>> >> The log for server start up reports no errors.
>> >>
>> >> The index page displays ok
>> >>
>> >> The manager page displays ok
>> >>
>> >> The example HelloWorld works ok
>> >>
>> >> The application webpages display ok.
>> >>
>> >> The problem appears to be with the servlet that reads the form data in
>> >> html page.
>> >>
>> >> I use default install structure for tomcat.  I add a applications
>> >> folder under TOMCAT 6.0\webapps\ROOT\myfoloder
>> >> Also add classes folder under tomcat 6.0\webapps\ROOT\WEB-INF\classes
>> >>
>> >> I attach copy of server start up log and http 500 error text when I
>> >> use the submit button on html page to activate servlet.
>> >>
>> >> would greatly appreciate your help.
>> >>
>> >> John Byrne
>> >>
>> >> --
>> >> 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
>> >>
>> >
>>
>>
>>
>> --
>> 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
>>
>



-- 
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

RE: Tomcat 6.0.26

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: John Byrne [mailto:jbmultitel@gmail.com]
> Subject: Re: Tomcat 6.0.26
> 
> is it complete?

Not sure what you're asking.

> I attach copy of my web.xml which i think is OK?

No, your <servlet-class> value is very, very wrong.  It should be:

<servlet-class>formprocessors.ukjava1900</servlet-class>

 - 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


Re: Tomcat 6.0.26

Posted by Pid <pi...@pidster.com>.
On 01/07/2010 18:55, John Byrne wrote:
> On 1 July 2010 16:25, Pid <pi...@pidster.com> wrote:
>> On 01/07/2010 15:52, John Byrne wrote:
> 
> Hi Chuck
> 
> Please find details of setup copied below
> 
> 
> <FORM action=/UkJava1900 method="post" name="payform"
> onsubmit = "return formCheck()">

This "formCheck" javascript function doesn't mangle the URL does it?

> The <servlet> and <servlet-mapping> tags both copied from
> webapps/myapp/WEB-INF/web.xml
> 
> 
>    <servlet>
>     <servlet-name>UkJava1900</servlet-name>
>     <servlet-class>formprocessors.UkJava1900</servlet-class>
>   </servlet>

The servlet class file is placed:

 comlinks/WEB-INF/classes/formprocessors/UkJava1900.class

?

>   <servlet-mapping>
>     <servlet-name>UkJava1900</servlet-name>
>     <url-pattern>/UkJava1900</url-pattern>
>   </servlet-mapping>
> 
> http status 404
> 
> description The requested resource (/UkJava1900d=%22post%22) is not available.
> 
> I have attempted to comply with your request below, please confirm the
> format of this email is acceptable.

Much better, thanks.


p



Re: Tomcat 6.0.26

Posted by André Warnier <aw...@ice-sa.com>.
Caldarale, Charles R wrote:
>> From: John Byrne [mailto:jbmultitel@gmail.com]
>> Subject: Re: Tomcat 6.0.26
>>
>> description The requested resource (/UkJava1900d=%22post%22)
>> is not available.
> 
> Which it certainly isn't - your URL is invalid.  Perhaps you meant to try:
> 
>   /UkJava1900?=%22post%22
> 
To me, it looks like it is the <Form ..> tag of the html page that is incorrect, and 
results in the bizarre target URL.
Please try this :

<FORM action="/UkJava1900" method="post" name="payform"
onsubmit="return formCheck()">


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


RE: Tomcat 6.0.26

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: John Byrne [mailto:jbmultitel@gmail.com]
> Subject: Re: Tomcat 6.0.26
> 
> HTTP 404 STATUS
> description The requested resource (/ukjava1900) is not available.

So how is the webapp deployed?  Location?  Contents of its <Context> element (and its location)?

 - 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


Re: Tomcat 6.0.26

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

John,

I think we might want to start again and work from the ground up. If
you've been working in the dark-ages with the invoker servlet and
non-packaged servlets, these things can pile up on you.

First of all, make it a point to put all your servlet classes into
packages. In fact, make it a point to put /all/ your classes into
packages. When you put a class into a package, the source (.java) file
should go into a directory that matches it, and when you compile it, the
.class file will end up in a similar directory.

For instance, if you have a class called "MyClass" in the package
"my.package" (classes are usually written in CamelCase while package
names are usually all lowercase), you should have your files laid out
like this:

src/my/package/MyClass.java

The source code to MyClass should have a package declaration like this:

package my.package;

when you compile to a directory called "build", you'll have:

build/my/package/MyClass.class

When you create your webapp, this file should go into
WEB-INF/classes/my/package/MyClass.class

Next, you'll need to map this class to one or more URLs. These URLs are
relative to what's known as the "context path" of a web application. Web
applications can be deployed either as a "root" web application (that
is, they will be accessed via a URL like http://host/servlet) or as a
non-root application with a non-blank context path (where you'll access
the webapp via a URL like http://host/context/servlet).

In web.xml, to map your servlet to "/UkJava1900", you should have (as it
appears you do):

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

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

Now, when you hit http://host/context/UkJava1900, you'll execute the
code in the formprocessors.UkJava1900 class (which came from
formprocessors/UkJava1900.java).

Note that URL patterns are case-sensitive. Your latest error message
says "The requested resource (/ukjava1900) is not available.". Note the
discrepancy between the <url-mapping> and the error message: the
capitalization is inconsistent. There's nothing that says your URL must
be /UkJava1900... you are free to use /ukjava1900 if you choose.

Now, we come to the JSP. Here is the best way to write your <form> tag:

<form
  method="post"
  action="<%= response.encode(request.getContextPath() + "/ukjava1900") %>">

Two things are happening, here:

1. request.getContextPath gets the current context path (like "/foo" if
your webapp is deployed to /foo, or "" if you are using a ROOT-deployed
context).

2. response.encode will add a jsessionid parameter to the end of the URL
if the client doesn't support HTTP cookies.

The first thing is important because it will allow you to re-deploy your
webapp under arbitrary context paths without having to re-write all your
links. The second is important if you want to support cookie-less
clients, which is always nice to do.

For recently-written webapps, I would recommend using the JSTL tag
library which has a convenient tag for doing things like this:

<form method="post" action="<c:url value="/ukjava1900" />">

The <c:url> tag knows how to do all the above stuff with less
possibility of typing errors and stuff. Always nice.

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

iEYEARECAAYFAkwtRUUACgkQ9CaO5/Lv0PDdGgCgjlRpxj6X+J+gU2/r8TRJzwoA
2F4An3hHCVfug56MHlC5y93i1UKvJgVP
=HiOG
-----END PGP SIGNATURE-----

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


Re: Tomcat 6.0.26

Posted by John Byrne <jb...@gmail.com>.
On 1 July 2010 19:00, Caldarale, Charles R

Dear Chuck

Sincere apologies

HTTP 404 STATUS

description The requested resource (/ukjava1900) is not available.

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: Tomcat 6.0.26

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: John Byrne [mailto:jbmultitel@gmail.com]
> Subject: Re: Tomcat 6.0.26
> 
> description The requested resource (/UkJava1900d=%22post%22)
> is not available.

Which it certainly isn't - your URL is invalid.  Perhaps you meant to try:

  /UkJava1900?=%22post%22

 - 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


Re: Tomcat 6.0.26

Posted by John Byrne <jb...@gmail.com>.
On 1 July 2010 16:25, Pid <pi...@pidster.com> wrote:
> On 01/07/2010 15:52, John Byrne wrote:

Hi Chuck

Please find details of setup copied below


<FORM action=/UkJava1900 method="post" name="payform"
onsubmit = "return formCheck()">

The <servlet> and <servlet-mapping> tags both copied from
webapps/myapp/WEB-INF/web.xml


   <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>

http status 404

description The requested resource (/UkJava1900d=%22post%22) is not available.

I have attempted to comply with your request below, please confirm the
format of this email is acceptable.



The list often strips attachments.  Please post inline, with comments
removed, in future.   It makes it easier to point out edits inline, as
below.

(It will also preserve the information you supplied for the achives so
others can learn too).

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: Tomcat 6.0.26

Posted by Pid <pi...@pidster.com>.
On 01/07/2010 15:52, John Byrne wrote:
> Hi
> 
> This is the first line in my java servlet ukjava1900 it compiles OK
> 
> package formprocessors;
> 
> is it complete?

Yes.  It wouldn't compile otherwise.

'UkJava1900' would be better than 'ukjava1900'</pedant>


> I attach copy of my web.xml which i think is OK?

The list often strips attachments.  Please post inline, with comments
removed, in future.   It makes it easier to point out edits inline, as
below.

(It will also preserve the information you supplied for the achives so
others can learn too).

You posted:

<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 Mult-i-tel International</display-name>
  <description>
     Welcome to Mult-i-tel International
  </description>

  <servlet>
    <servlet-name>ukjava1900</servlet-name>

<servlet-class>webapps/comlinks/WEB-INF/classes/formprocessors/ukjava1900</servlet-class>

^^
This is incorrect: don't put a path here, just specify the classname,
which is currently "formprocessors.ukjava1900", a Servlet Container will
find it automatically.

  </servlet>

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

</web-app>


Which web.xml is this?

The one from comlinks/WEB-INF/web.xml, or somewhere else?


p



> Kind regards
> 
> John
> 
> On 1 July 2010 14:08, Pid <pi...@pidster.com> wrote:
>> On 01/07/2010 13:26, Shay Rojansky wrote:
>>> /servlet/com/multitel/ukjava1900). Change this to
>>
>>  "/servlet/ukjava1900"
>>
>> according to the HTML form 'action' attribute.
>>
>> Also, a minor pedantic note: conventionally, classes are defined with
>> capitalised names.  So one would expect to see it called
>> "com.multitel.UkJava1900.class"
>>
>>
>> p
>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>
>>
>>
>>
> 
> 
> 



Re: Tomcat 6.0.26

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

This is the first line in my java servlet ukjava1900 it compiles OK

package formprocessors;


is it complete?

I attach copy of my web.xml which i think is OK?

Kind regards

John

On 1 July 2010 14:08, Pid <pi...@pidster.com> wrote:
> On 01/07/2010 13:26, Shay Rojansky wrote:
>> /servlet/com/multitel/ukjava1900). Change this to
>
>  "/servlet/ukjava1900"
>
> according to the HTML form 'action' attribute.
>
> Also, a minor pedantic note: conventionally, classes are defined with
> capitalised names.  So one would expect to see it called
> "com.multitel.UkJava1900.class"
>
>
> p
>
>>> ---------------------------------------------------------------------
>>> 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

Re: Tomcat 6.0.26

Posted by Pid <pi...@pidster.com>.
On 01/07/2010 13:26, Shay Rojansky wrote:
> /servlet/com/multitel/ukjava1900). Change this to

 "/servlet/ukjava1900"

according to the HTML form 'action' attribute.

Also, a minor pedantic note: conventionally, classes are defined with
capitalised names.  So one would expect to see it called
"com.multitel.UkJava1900.class"


p

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



Re: Tomcat 6.0.26

Posted by Shay Rojansky <ro...@roji.org>.
Hi.

pid's right - you should really put your classes in packages (although I'm
pretty sure it's not technically mandatory). But looking at your attached
files, I think I see another problem - confusion between the Java class
package and the servlet mapping.

In the web.xml <servlet> element, you reference a Java class and give it a
servlet name. Looking at your web.xml, I see a ukjava1900 servlet with the
class com.multitel.ukjava1900. This means that you must have a
myApp\WEB-INF\classes\com\multitel\ukjava1900.class in your webapp. All good
till now.

The web.xml <servlet-mapping> element maps a servlet name (defined above) to
actual URLs that will be used to access that webapp. This URL has nothing to
do with the Java class. In your web.xml, I see
<url-pattern>/com/multitel/ukjava1900</url-pattern>
- this is wrong (unless you want users to access
/servlet/com/multitel/ukjava1900). Change this to
<url-pattern>/ukjava1900</url-pattern> and it should work.

Try to understand the difference between your Java classes, their packages
and the directory hierarchy under WEB-INF\classes on the one hand, and the
URL namespace of your webapp on the other.

Shay

On Thu, Jul 1, 2010 at 5:48 AM, John Byrne <jb...@gmail.com> wrote:

> Hi Shay
>
> Still having problems with reading html form with servlet.
>
> We only have a small number of servlets and would choose not to place
> them in a package at this point in time.
>
> I understand your naming of package com.company.project, can you
> replace com\mycompany\Myservlet.class. What is the link between them.
>
> I noted your comment on web.xml file  Have been using tomcat for 3/4
> years and have most probably got away with murder using invoker
> servlet and mapping of.
>
> I attach a file with html form action, server start up log, web.xml
> file and error http 404
>
> We only have a small number of servlets and would choose not to place
> them in a package at this point in time.
>
> I understand your naming of package com.company.project, can you
> replace com\mycompany\
>
> On 28 June 2010 13:26, Shay Rojansky <ro...@roji.org> wrote:
> > Hi John.
> >
> > Both John and I were right... Moving your directory outside ROOT was the
> > first step.
> >
> > Now, in your web.xml, the <servlet-class> element is wrong. It should
> > contain a servlet class that should be found under your WEB-INF/classes
> > directory. So if you want to reference the class that you have under
> > comlinks\WEB-INF\classes\com\mycompany\MyServlet.class, simply put
> > "com.mycompany.MyServlet" in the <servlet-class> element.
> >
> > By the way, it's hard to tell what your class name and package actually
> are.
> > It's a good idea to follow conventions and place it in a package called
> > com.company.project
> >
> > Shay
> >
> > On Mon, Jun 28, 2010 at 5:11 AM, John Byrne <jb...@gmail.com>
> wrote:
> >
> >> Hi Shay
> >>
> >> copy of directory structure
> >>
> >> C:\Tomcat 6.0\webapps\comlinks\WEB-INF\classes>
> >>
> >> I have changed this it incorporate your suggestions.
> >>
> >> I attach a copy of web.xml
> >>
> >> many thanks for your help.
> >>
> >> Kind Regards
> >>
> >> John
> >>
> >> On 27 June 2010 15:54, Shay Rojansky <ro...@roji.org> wrote:
> >> > John,
> >> >
> >> > Can you please send your web.xml as well? I would be it's a
> misconfigured
> >> > <servlet> in there (the WEB-INF should not be part of the class
> package
> >> > name, as it appears in your error log).
> >> >
> >> > Shay
> >> >
> >> > On Sun, Jun 27, 2010 at 7:55 AM, John Byrne <jb...@gmail.com>
> >> wrote:
> >> >
> >> >> Hi
> >> >>
> >> >> Have installed tomcat 6.0.26 on windows 7.
> >> >>
> >> >> Have installed jdk1.6.0_20 to use with tomcat
> >> >>
> >> >> The javac and java commands both give correct response at dos prompt.
> >> >>
> >> >> The log for server start up reports no errors.
> >> >>
> >> >> The index page displays ok
> >> >>
> >> >> The manager page displays ok
> >> >>
> >> >> The example HelloWorld works ok
> >> >>
> >> >> The application webpages display ok.
> >> >>
> >> >> The problem appears to be with the servlet that reads the form data
> in
> >> >> html page.
> >> >>
> >> >> I use default install structure for tomcat.  I add a applications
> >> >> folder under TOMCAT 6.0\webapps\ROOT\myfoloder
> >> >> Also add classes folder under tomcat 6.0\webapps\ROOT\WEB-INF\classes
> >> >>
> >> >> I attach copy of server start up log and http 500 error text when I
> >> >> use the submit button on html page to activate servlet.
> >> >>
> >> >> would greatly appreciate your help.
> >> >>
> >> >> John Byrne
> >> >>
> >> >> --
> >> >> 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
> >> >>
> >> >
> >>
> >>
> >>
> >> --
> >> 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
> >>
> >
>
>
>
> --
> 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: Tomcat 6.0.26

Posted by Pid <pi...@pidster.com>.
On 01/07/2010 10:48, John Byrne wrote:
> Hi Shay
> 
> Still having problems with reading html form with servlet.
> 
> We only have a small number of servlets and would choose not to place
> them in a package at this point in time.
> 
> I understand your naming of package com.company.project, can you
> replace com\mycompany\Myservlet.class. What is the link between them.
> 
> I noted your comment on web.xml file  Have been using tomcat for 3/4
> years and have most probably got away with murder using invoker
> servlet and mapping of.
> 
> I attach a file with html form action, server start up log, web.xml
> file and error http 404
> 
> We only have a small number of servlets and would choose not to place
> them in a package at this point in time.

Fail.

> I understand your naming of package com.company.project, can you
> replace com\mycompany\

You must put your servlets in a package - it's trivial to do so and bad
practice not to.  The package corresponds to the directory structure.

 com.mycompany.webstuff.Form1Servlet

is placed:

 myApp/WEB-INF/classes/com/mycompany/webstuff/Form1Servlet.class

You can use any package structure you like, the above is an example of
the convention for a COMpany, called 'My Company', with a library of
code called 'Web Stuff'.

If you don't want a deep folder tree, just use a single directory:

 package formprocessors;

 public class Form1Servlet extends HttpServlet {
 ...

Full class reference:

 formprocessors.Form1Servlet

Location:

 myApp/WEB-INF/classes/formprocessors/Form1Servlet.class


p


> On 28 June 2010 13:26, Shay Rojansky <ro...@roji.org> wrote:
>> Hi John.
>>
>> Both John and I were right... Moving your directory outside ROOT was the
>> first step.
>>
>> Now, in your web.xml, the <servlet-class> element is wrong. It should
>> contain a servlet class that should be found under your WEB-INF/classes
>> directory. So if you want to reference the class that you have under
>> comlinks\WEB-INF\classes\com\mycompany\MyServlet.class, simply put
>> "com.mycompany.MyServlet" in the <servlet-class> element.
>>
>> By the way, it's hard to tell what your class name and package actually are.
>> It's a good idea to follow conventions and place it in a package called
>> com.company.project
>>
>> Shay
>>
>> On Mon, Jun 28, 2010 at 5:11 AM, John Byrne <jb...@gmail.com> wrote:
>>
>>> Hi Shay
>>>
>>> copy of directory structure
>>>
>>> C:\Tomcat 6.0\webapps\comlinks\WEB-INF\classes>
>>>
>>> I have changed this it incorporate your suggestions.
>>>
>>> I attach a copy of web.xml
>>>
>>> many thanks for your help.
>>>
>>> Kind Regards
>>>
>>> John
>>>
>>> On 27 June 2010 15:54, Shay Rojansky <ro...@roji.org> wrote:
>>>> John,
>>>>
>>>> Can you please send your web.xml as well? I would be it's a misconfigured
>>>> <servlet> in there (the WEB-INF should not be part of the class package
>>>> name, as it appears in your error log).
>>>>
>>>> Shay
>>>>
>>>> On Sun, Jun 27, 2010 at 7:55 AM, John Byrne <jb...@gmail.com>
>>> wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> Have installed tomcat 6.0.26 on windows 7.
>>>>>
>>>>> Have installed jdk1.6.0_20 to use with tomcat
>>>>>
>>>>> The javac and java commands both give correct response at dos prompt.
>>>>>
>>>>> The log for server start up reports no errors.
>>>>>
>>>>> The index page displays ok
>>>>>
>>>>> The manager page displays ok
>>>>>
>>>>> The example HelloWorld works ok
>>>>>
>>>>> The application webpages display ok.
>>>>>
>>>>> The problem appears to be with the servlet that reads the form data in
>>>>> html page.
>>>>>
>>>>> I use default install structure for tomcat.  I add a applications
>>>>> folder under TOMCAT 6.0\webapps\ROOT\myfoloder
>>>>> Also add classes folder under tomcat 6.0\webapps\ROOT\WEB-INF\classes
>>>>>
>>>>> I attach copy of server start up log and http 500 error text when I
>>>>> use the submit button on html page to activate servlet.
>>>>>
>>>>> would greatly appreciate your help.
>>>>>
>>>>> John Byrne
>>>>>
>>>>> --
>>>>> 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
>>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> 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
>>>
>>
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org