> Dear all,
>
> can anybody tell me how to instantiate a bean in a servlet.I have made some
> java bean classes and i want to use the methods of these bean classes inside
> my servlet which further connects to a database using JDBC.
>
> thanks
> Rohit
> [...]

Hi :-)  I suggest you try the following:
* if you want use a Class in "runtime"(you don't know it in compiling-time),
  you can use Java-Reflection; or you can use:
  - "new MyUtility(...)"
  - MyUtility.class.newInstance()...

* normally, the utility class is initialized in:
   - init(...) of Servlet
   - ServletContextListener (Servlet 2.3)
     http://www.javaworld.com/javaworld/jw-01-2001/jw-0126-servletapi_p.html

* you can select which ClassLoader will load MyUtility,
   for example, with TC4.0-b5, I can do it by putting
   MyUtility in different folder.
   - TOMCAT_HOME/classes(for unpacked class file),
      TOMCAT_HOME/lib(for jar file)
   - WEB-INF/classes(for unpacked class file), WEB-INF/lib(for jar file)
   - ...


have a nice day :-)


Bo
July 11, 2001

___________________________________________________________________________
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