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 <jbmulti...@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 <r...@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 <jbmulti...@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 <r...@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 <jbmulti...@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-unsubscr...@tomcat.apache.org
> >> >> For additional commands, e-mail: users-h...@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-unsubscr...@tomcat.apache.org
> >> For additional commands, e-mail: users-h...@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-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

Reply via email to