tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <...@pidster.com>
Subject Re: Tomcat 6.0.26
Date Thu, 01 Jul 2010 10:19:46 GMT
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 <roji@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 <jbmultitel@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 <roji@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 <jbmultitel@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



Mime
View raw message