You were lucky in the first one, second one, luck wasn't there.

----- Original Message -----
From: "BacardiWasabi" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, November 14, 2001 11:02 PM
Subject: Servlet Mapping...:(


> time for a silly question...
>
>
>
> file - web.xml
>
>
> <servlet>
>             <servlet-name>TestAction</servlet-name>
>             <servlet-class>ActionServlet</servlet-class>
> </servlet>
>
>
> <servlet-mapping>
>             <servlet-name>TestAction</servlet-name>
>             <url-pattern>/TestAction</url-pattern>
> </servlet-mapping>
>
Over here, you mapped the   /servlet/TestAction to /TestAction,
so it is availble at both /servlet/TestAction and /TestAction URL
>
> ActionServlet - web-inf\classes
>
> Context path - framework
>
> a) when my url is
> http:...:8080/framework/servlet/TestAction - it is
> working fine
>
> b) but when i make change to servlet mapping to above
> web.xml as
>
> <servlet-mapping>
>             <servlet-name>TestAction</servlet-name>
>             <url-pattern>/action</url-pattern>
>     </servlet-mapping>
>

Over here, you mapped the   /servlet/TestAction to /action
,
so it is availble at both /servlet/TestAction and /action URL


>
> and invoke
> http:...:8080/framwork/servlet/action - im getting
> page cannot be found

so you should access it using /framework/action

You mapped the URL but you are not trying to use the power of mapped URLs.
I don't think youi need to map any url if you want to access them using
/servlet/ClassName

something its good to map a servlet name to a class name when say class name
is   com.pritpal.dhaliwal.mother.s.lastname.RealClassName
to RealClassName
so you would do it like this:

 <servlet>
             <servlet-name>RealClassName</servlet-name>
             <servlet-class>
com.pritpal.dhaliwal.mother.s.lastname.RealClassName </servlet-class>
 </servlet>

Above you had:
> <servlet>
>             <servlet-name>TestAction</servlet-name>
>             <servlet-class>ActionServlet</servlet-class>
> </servlet>

which ofcourse works, but again, you are not using power of mapping class
name to servlet names.
( its not same as mapping servlet names to URLs, just to make sure)



> restarted my server...


Regards,

Pritpal Dhaliwal


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to