Simone Chiaretta wrote:
I store properties in my the app WEB-INF/web.xml

        <context-param>
                <param-name>smtpServer</param-name>
                <param-value>my.smtpserver.net</param-value>
                <description>SMTP server to be used to send email from forms in the
website</description>
        </context-param>

and I access the value also in JSP pages with

String value = getServletContext().getInitParameter("smtpServer");

and I assure u that it works even with JSP not only with servlet,

Because JSPs are servlets.


but I
never tryed accessing it from inside a bean.

Because you can't, unless you pass the data to the bean somehow (via constructor or method arg) then it has no knowledge of the ServletContext.


To the OP: just use the Properties file from the JavaBean the way you would normally in a non-webapp Java application. To be visible to the Tomcat classloader, put your Properties file in WEB-INF/classes or jar it up and put it in WEB-INF/lib.



Erik


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to