There is a jspInit() method in a JSP that you can 'override' by doing:
<%!
public void jspInit() {
}
%>
So the answer for 'how' is; "the same way"
> -----Original Message-----
> From: Tom K [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 22, 2004 12:58 PM
> To: [EMAIL PROTECTED]
> Subject: Database connection going from servlet to a bean
>
>
> I am going from a html-->servlet-->output to a
> jsp-->javabean-->jsp configuration.
>
> In my servlet I connect via JNDI like this:
> public void init(ServletConfig config) throws ServletException{
> super.init(config);
> try{
> Context env = (Context) new
> InitialContext().lookup("java:comp/env");
> pool = (DataSource) env.lookup("jdbc/app1");
>
> if (pool == null)
> throw new ServletException("`jdbc/app1' is an
> unknown DataSource");
> }catch (NamingException e) {
> throw new ServletException(e);
> }
>
> How would I connect using a JSP? Or would this be done in the
> javabean?
>
> TIA
>
> Tom K.
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]