Luca:

If you implement SingleThreadModel in a servlet, the container will
instantiate instances as and when it falls short of them, hence pool
management is left to the container.

There could be some proprietary way of doing this in some container, I do
not recall a J2EE way of doing this. In any case, I do not think you need to
worry about the number of instances, as explained above.

Regards
Sanjeev

-----Original Message-----
From: Luca Ventura [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 24, 2002 4:43 PM
To: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology.
Cc: [EMAIL PROTECTED]
Subject: R: How to run multiple instances of JSP pages/servlets in
Tomcat?



Hello!

Thank you very much for your help! :-)

About the second question the reason I asked it is that one you said: I need
to implement the interface "SingleThreadModel", so for performance reasons
I would like to activate more separate instances of the same servlet (or
jsp-page)
on Tomcat. I know there is a way to do this (I read something about it in
the past
but I don't remember where exactly...:-( ) but I don't know what it is.

Can you help me?

Thanks a lot.

                Luca

-----Messaggio originale-----
Da: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]Per conto di
Sanjeev Verma
Inviato: marted́ 24 settembre 2002 12.38
A: [EMAIL PROTECTED]
Oggetto: Re: How to run multiple instances of JSP pages/servlets in
Tomca t?


Hi Luca,

For your first question, check out the DTD of web.xml, the definition of the
<servlet> element is given as below:

<!ELEMENT servlet (icon?, servlet-name, display-name?, description?,
(servlet-class | jsp-file), init-param*, load-on-startup?, run-as?,
security-role-ref*)>

This clearly shows, that you can either give a <servlet-class> OR a
<jsp-file> after the servlet-name tag.

Hence, to answer your question, the web.xml would look like this:

<servlet>
        <servlet-name>MyServlet</servlet-name>
        <jsp-file>MyJSP.jsp</jsp-file>
        <init-param>
                <param-name>configFile</param-name>
                <param-value>my.conf</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
</servlet>

This should do the trick.

Regarding your second question, servlet and generated servlets out of JSPs
are accessed by multiple threads at the same time. Hence, there is really no
need for having multiple instances of a servlet. Every new client accesses
the same servlet instance thru' a new service thread.

Still, if you need to have multiple instance for synchronization reasons,
explore the SingleThreadModel interface. I do not think you are looking for
this, but just in case.

Best Regards
Sanjeev



-----Original Message-----
From: Luca Ventura [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 24, 2002 3:47 PM
To: [EMAIL PROTECTED]
Subject: How to run multiple instances of JSP pages/servlets in Tomcat?


Hello everybody!

In Tomcat 4.x I don't know how I can call automatically a JSP page when the
web application starts.
I mean...in Tomcat 4.x there is the web.xml file where I can declare:

<servlet>
        <servlet-name>MyServlet</servlet-name>
        <servlet-class>MyServlet</servlet-class>
        <init-param>
                <param-name>configFile</param-name>
                <param-value>my.conf</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
</servlet>

In this way the servlet "MyServlet" is called when the web app. starts...

Can I do the same thing with a jsp page (the jsp page should be like a
servlet, in fact it is translated into a servlet when it is called the first
time)? If yes, in which way?

Another questions: how can I tell the Web Server "Tomcat" to activate more
instances
of a servlet or a JSP page?

Thanks a lot to everybody!

                                            Luca

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to