I've handled this by using a servlet filter that intercepts all requests
(something like this in your web.xml file)...

<filter-mapping>
     <filter-name>Do Startup Filter</filter-name>
     <url-pattern>/*</url-pattern>
</filter-mapping>

Then inside the do.. method you can set up your object and attach to either
a context such as your session or to the ServletContext (if you want it
globally available).

However, I don't know know if this is the best way - one problem is that the
startup cost is suffered by the first user to hit the site, whereas it would
be better if the startup was performed when tomcat itself starts up. This is
not such an issue I guess for a site that is hammered the second it comes
up.



On 6/23/06, 0 8 <[EMAIL PROTECTED]> wrote:

Hello,

I have a newbie Tomcat question.

A search application I need to work with uses RMI.  When I start
Tomcat, is there a way I can run the code to create an object that I
can reference in a JSP later?

What I need to run is straight forward:

ClientServices cs =
com.mycompany.searchapp.ClientServicesFactory.getInstance("RMI",
parms); // Get the ClientServices
cs.Login(strDomain, strUser, strPassword); // Login

Can I run this and reference the object cs from my JSP?

If someone could point me in a general direction it would be
appreciated.  If there's a better way to handle this, I'm open to
suggestions.

Thanks,
Matt

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to