You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alexis Alarcón Barra <al...@yahoo.com> on 2001/07/30 18:47:13 UTC

Creating object for the application

Hi,
anyone knows how to create an object from the startup of the server and
make it available for the application. I don't want to call a servlet to
get it from a JSP page. Is there another way?

Alexis


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: Creating object for the application

Posted by Alexis Alarcón Barra <al...@yahoo.com>.
ok ... i've done already that, but how can get the object on a jsp page to
manipulate it?

Alexis

"Craig R. McClanahan" wrote:

> On Mon, 30 Jul 2001, Alexis Alarcón Barra wrote:
>
> > Hi,
> > anyone knows how to create an object from the startup of the server and
> > make it available for the application. I don't want to call a servlet to
> > get it from a JSP page. Is there another way?
> >
>
> In any servlet container that implements 2.2 or later, you can create a
> servlet that is marked <load-on-startup> in the web.xml file, and then
> create your objects in the init() method of that servlet.  For more info
> about web.xml, see the Servlet Specification at
>
>   http://java.sun.com/products/servlet/download.html
>
> For servlet 2.3 containers (i.e. Tomcat 4.0 for now, others soon), you can
> also use the new "Application Event Listener" mechanism to register a
> class that is told about the context startup and context shutdown
> events.  This is a perfect place to initialize things at startup time.
>
> > Alexis
> >
>
> Craig McClanahan


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: Creating object for the application

Posted by Alexis Alarcón Barra <al...@yahoo.com>.
Thanks Craig!! It worked !!

Alexis

"Craig R. McClanahan" wrote:

> On Mon, 30 Jul 2001, Alexis Alarcón Barra wrote:
>
> > ok ... i've done already that, but how can get the object from a jsp page to
> > manipulate it?
> >
>
> If you create a servlet context attribute, then it's just a <jsp:useBean>
> declaration with "application" scope.
>
> > Alexis
> >
>
> Craig McClanahan
>
> > "Craig R. McClanahan" wrote:
> >
> > > On Mon, 30 Jul 2001, Alexis Alarcón Barra wrote:
> > >
> > > > Hi,
> > > > anyone knows how to create an object from the startup of the server and
> > > > make it available for the application. I don't want to call a servlet to
> > > > get it from a JSP page. Is there another way?
> > > >
> > >
> > > In any servlet container that implements 2.2 or later, you can create a
> > > servlet that is marked <load-on-startup> in the web.xml file, and then
> > > create your objects in the init() method of that servlet.  For more info
> > > about web.xml, see the Servlet Specification at
> > >
> > >   http://java.sun.com/products/servlet/download.html
> > >
> > > For servlet 2.3 containers (i.e. Tomcat 4.0 for now, others soon), you can
> > > also use the new "Application Event Listener" mechanism to register a
> > > class that is told about the context startup and context shutdown
> > > events.  This is a perfect place to initialize things at startup time.
> > >
> > > > Alexis
> > > >
> > >
> > > Craig McClanahan
> >
> >
> > _________________________________________________________
> > Do You Yahoo!?
> > Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: Creating object for the application

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Mon, 30 Jul 2001, Alexis Alarcón Barra wrote:

> ok ... i've done already that, but how can get the object from a jsp page to
> manipulate it?
> 

If you create a servlet context attribute, then it's just a <jsp:useBean>
declaration with "application" scope.


> Alexis
> 

Craig McClanahan


> "Craig R. McClanahan" wrote:
> 
> > On Mon, 30 Jul 2001, Alexis Alarcón Barra wrote:
> >
> > > Hi,
> > > anyone knows how to create an object from the startup of the server and
> > > make it available for the application. I don't want to call a servlet to
> > > get it from a JSP page. Is there another way?
> > >
> >
> > In any servlet container that implements 2.2 or later, you can create a
> > servlet that is marked <load-on-startup> in the web.xml file, and then
> > create your objects in the init() method of that servlet.  For more info
> > about web.xml, see the Servlet Specification at
> >
> >   http://java.sun.com/products/servlet/download.html
> >
> > For servlet 2.3 containers (i.e. Tomcat 4.0 for now, others soon), you can
> > also use the new "Application Event Listener" mechanism to register a
> > class that is told about the context startup and context shutdown
> > events.  This is a perfect place to initialize things at startup time.
> >
> > > Alexis
> > >
> >
> > Craig McClanahan
> 
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 


Re: Creating object for the application

Posted by Alexis Alarcón Barra <al...@yahoo.com>.
ok ... i've done already that, but how can get the object from a jsp page to
manipulate it?

Alexis

"Craig R. McClanahan" wrote:

> On Mon, 30 Jul 2001, Alexis Alarcón Barra wrote:
>
> > Hi,
> > anyone knows how to create an object from the startup of the server and
> > make it available for the application. I don't want to call a servlet to
> > get it from a JSP page. Is there another way?
> >
>
> In any servlet container that implements 2.2 or later, you can create a
> servlet that is marked <load-on-startup> in the web.xml file, and then
> create your objects in the init() method of that servlet.  For more info
> about web.xml, see the Servlet Specification at
>
>   http://java.sun.com/products/servlet/download.html
>
> For servlet 2.3 containers (i.e. Tomcat 4.0 for now, others soon), you can
> also use the new "Application Event Listener" mechanism to register a
> class that is told about the context startup and context shutdown
> events.  This is a perfect place to initialize things at startup time.
>
> > Alexis
> >
>
> Craig McClanahan


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: Creating object for the application

Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Mon, 30 Jul 2001, Alexis Alarcón Barra wrote:

> Hi,
> anyone knows how to create an object from the startup of the server and
> make it available for the application. I don't want to call a servlet to
> get it from a JSP page. Is there another way?
> 

In any servlet container that implements 2.2 or later, you can create a
servlet that is marked <load-on-startup> in the web.xml file, and then
create your objects in the init() method of that servlet.  For more info
about web.xml, see the Servlet Specification at

  http://java.sun.com/products/servlet/download.html

For servlet 2.3 containers (i.e. Tomcat 4.0 for now, others soon), you can
also use the new "Application Event Listener" mechanism to register a
class that is told about the context startup and context shutdown
events.  This is a perfect place to initialize things at startup time.

> Alexis
> 

Craig McClanahan