"Gerstmair, Anja" wrote:
>
> My bean needs a properties file. The properties file itself contains for
> example the name of the database.
> When I call my bean from outside the JSP pages, I can specify the location
> of the properties file, eg.
> java -Dproppath=c:\...\my.properties ...
> But when I call the bean from within the JSP pages, how can I set the path
> of the properties file.
> I could write it to the JSP directly, but this is not very nice.
> Any ideas?
I suggest you specify it as a context init parameter value in the web.xml
file, and give a reference to the context (the "application" variable in a
JSP page) to the bean with <jsp:setProperty>. Even better may be to change
your bean into a custom action, since a custom action has access to the
context automatically.
See the JSP and Servlet specifications for details.
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets