tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Wingfield <jon.wingfi...@mkodo.com>
Subject Re: Accessing a servlet
Date Wed, 12 Jul 2006 13:49:14 GMT
OK. The web.xml entries should probably be something like this:

<servlet>
   <servlet-name>just-a-little-test</servlet-name>
   <servlet-class>firstpack.JustAlittleTest</servlet-class>
</servlet>
<servlet-mapping>
   <servlet-name>just-a-little-test</servlet-name>
   <url-pattern>/some/useful/mapping</url-pattern>
</servlet-mapping>

and the form action should be "/some/useful/mapping".
I changed the names so they weren't all JustAlittleTest ;)


As to the logs, I assumed there would be stacktraces in the logs for 
ClassNotFound/NoClassDefFound exceptions if the mapping was not valid.

HTH,

Jon

McRaven, Brian wrote:
> I made the servlet part of a package but I'm getting a Servlet not Found
> Exception.  The actions I took to make the servlet part of a package are
> the following:
> 
> 1 added package line to java code, recompiled
> 2 placed new class file in new subdirectory of WEB-INF/classes folder
> with same name of package
> 3 changed entry in web.xml file to reflect package that servlet is in
> for the url-pattern
> 4 changed JSP so that the forms action="firstpack.JustALittleTest"
> 
> I've looked at the log files but I'm not sure what to look for.
> 
> Brian
> 
> -----Original Message-----
> From: Jon Wingfield [mailto:jon.wingfield@mkodo.com] 
> Sent: Wednesday, July 12, 2006 7:49 AM
> To: Tomcat Users List
> Subject: Re: Accessing a servlet
> 
> I would check in tomcat logs directory for reasons why the servlet is
> not available. One reason could be that classes should be in a package:
> 
> http://tomcat.apache.org/faq/classnotfound.html
> 
> HTH,
> 
> Jon
> 
> McRaven, Brian wrote:
>> OK I did that and now my system is hanging which I guess could be an 
>> error in my code or something with the server.  I think it is my code 
>> so I'll look that over.  Thanks for your help.  Sorry for the
> confusion.
>> Brian
>>
>> -----Original Message-----
>> From: David Smith [mailto:dns4@cornell.edu]
>> Sent: Tuesday, July 11, 2006 2:48 PM
>> To: Tomcat Users List
>> Subject: Re: Accessing a servlet
>>
>> Did you reload the webapp after making the change?  All changes to 
>> WEB-INF/web.xml or files in WEB-INF/classes and WEB-INF/lib will 
>> require a reload before they become active in tomcat.
>>
>> --David
>>
>> McRaven, Brian wrote:
>>
>>> I was able to refer to a book I have and so I dropped the .class 
>>> extensions altogether.  I get an error that requested resource is not
> 
>>> available still.  Any suggestions on this?  My web.xml file has this
>>> entry:
>>>
>>>    <servlet>
>>>       <servlet-name>JustALittleTest</servlet-name>
>>>       <servlet-class>JustAlittleTest</servlet-class>
>>>    </servlet>
>>>
>>>    <servlet-mapping>
>>>       <servlet-name>JustALittleTest</servlet-name>
>>>       <url-pattern>/JustALittleTest</url-pattern>
>>>    </servlet-mapping>
>>>
>>> And my action attribute="JustALittleTest".
>>>
>>> Brian
>>>
>>>
>>> -----Original Message-----
>>> From: McRaven, Brian
>>> Sent: Tuesday, July 11, 2006 1:14 PM
>>> To: users@tomcat.apache.org
>>> Subject: Accessing a servlet
>>>
>>> Well I'm ticking these newbie questions off.  I have a simple servlet
> 
>>> that I want my form to access.  I compiled the file fine and it is 
>>> called JustALittleTest.class.  I placed this file in the 
>>> ROOT/WEB-INF/classes folder.  In my JSP I have a form with some 
>>> submit buttons.  The action element of the form is set to
> ="JustALittleTest".
>>> I changed my web.xml file so it now has the following entries:
>>>
>>>    <servlet>
>>>       <servlet-name>JustALittleTest</servlet-name>
>>>       <servlet-class>JustAlittleTest.class</servlet-class>
>>>    </servlet>
>>>
>>>    <servlet-mapping>
>>>       <servlet-name>JustALittleTest</servlet-name>
>>>       <url-pattern>/JustALittleTest.class</url-pattern>
>>>    </servlet-mapping>
>>>
>>> I've tried a few changes to the above entries but I haven't gotten it
> 
>>> right yet.  Should the servlet-class value have a .class extension?  
>>> Is
>>> my url pattern accessing the correct folder?
>>>
>>> Brian
>>>



---------------------------------------------------------------------
To start a new topic, e-mail: users@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