In web.xml you can use
<env-entry>
<env-entry-name>username</env-entry-name>
<env-entry-value>myusename</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
and you can access this from bean like this..
String username = (String)ctx.lookup("java:comp/env/username");
For this you need to import javax.naming.*;
Well why you need to edit the web.xml?? cuz usually database deails will be
changing and you need to upadate the web.xml regularly. You cant expect the
end user to do it. so you need to provide seperate UI for this and read
web.xml from a XML parser ( Sun hasnt provided any methods to edit the
web.xml programatically ) and update it as user interacts with your system
providing the latest details of database.
web.xml is for giving instruction related to deployment not for updating
system properties. So I feel its better to keep these details in a different
file and use them.
Cheers.
Lakshmeenarayana G G
ArisGlobal India Development Center,
SysArris Software Pvt. Ltd.,
Bangalore, India
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED] Behalf Of Deepak
Sent: Wednesday, March 26, 2003 11:53 AM
To: [EMAIL PROTECTED]
Subject: DB Connection in web.xml
Hi
Can anyone tell me how to set up a db connection in the web.xml?
I mean how to set the driver, url, user and pwd as parameters and how to
call
them in the jsp page or servlet.
Is it possible to call the same from a javabean?
Thanks
Deepak
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant archives, FAQs and Forums on JSPs can be found at:
http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant archives, FAQs and Forums on JSPs can be found at:
http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com