S Ramakrishnan wrote:
> I am afraid I do not understand. Why are the two correlated?
> Unless I am mistaken, servlet mapping is for
> arriving at compact URLs for user convenience.
>
> Why is this mandatory in order to specify
> <init-parm>'s?
>
> Thanks,
>
> Rk
> x77309
>
> On Mon, 26 Feb 2001 10:58:44
> Craig R. McClanahan wrote:
> >
> >
> >S Ramakrishnan wrote:
> >
> >> Environment:
> >> Tomcat 4.0 on NT4.0
> >> Browser: IE5.5
> >>
> >> Problem:
> >> I am unable to get <init-param> to work.
> >> In my web.xml I have
> >> <servlet>
> >> <servlet-name>Quote</servlet-name>
> >> <servlet-class>Quote</servlet-class>
> >> <init-param>
> >> <param-name>quotesFile</param-name>
> >> <param-value>quotes.txt</param-value>
> >> </init-param>
> >> </servlet>
> >>
> >> The ServletContext in init() fetches null for
> >> init-param "quotesFile". (I've tried restrating catalina).
> >>
> >
> >For this to be recognized, you need to do two more things:
> >
> >* Establish a servlet mapping for your servlet:
> >
> > <servlet-mapping>
> > <servlet-name>Quote</servlet-name>
> > <url-pattern>/quote</url-pattern>
> > </servlet-mapping>
> >
> >* Use this mapping in the URL that requests the servlet:
> >
> > http://localhost:8080/myapp/quote
> >
> >where "/myapp" is the context path of your web application.
> >
> >>
> >> Could someone please give me an example of
> >> storing and using resources (say, Files) in my
> >> web application? I am not sure if I should put the file
> >> in thge root of the web app or in the classes directory.
> >>
> >> Thanks,
> >>
> >> Rk
> >> x77309
> >>
> >
> >Craig McClanahan
> [...]
Hi :-) I am not sure, from several emails and my understanding:
* every sevlet defination(<servlet></servlet>) will use one instance
of MyServlet, if we invoke MyServlet without
servlet-mapping(<servlet-mapping></servlet-mapping>), it means
now we want to use a "default" sevlet defination.
* every group of init-param(<init-param></init-param>) belong to
one special sevlet defination(but I guess the "default" sevlet defination
can ont has any initParameter->null).
* from the viewing of client's invoking, how can we let Servlet container
know that which sevlet defination we want to use? I guess the only
way is use servlet-mapping(if we don't use the "default" servlet-mapping,
i.e., we use http://host:8080/myapp/servlet/MyServlet to invoke, , now
it means we want to use the "default" sevlet defination) .
* so I think at least servlet-mapping has two usages:
- for user convenience
- we use it to distinguish this servlet defination and that
servlet defination, Then we can distinguish this group.
of init-param and that group of init-param
* in a short word, because:
- init-param has relation with servlet defination
- servlet-mapping also has relation with servlet defination
So init-param has relation with servlet-mapping
I just know it this afternoon :-) because I use winnt40,
and I omit the difference between "WEB-INF" and "Web-inf" :-)
so MyServlet can not read my web.xml in "Web-inf" :-)
I spent several hours, and finally I correct Web-inf to
WEB-INF... but After modifing, in the "File Manager" of winnt40,
it Still looks like "Web-inf"... //hahahahaha :-) :-)
Bo
Feb.26, 2001
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]