M
Mike Mayer
I'm having two problems with trying to read strings out of struts config
files. My google skills must be out of whack, because this should be easy
enough to find
First problem:
I'm trying to read a param in web.xml. Here's a snippet of the web.xml and
the code I am using to try to read the value. Does this look like I'm on the
right track? Because smtpServer is null...
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>mailServer</param-name>
<param-value>smtp.mydomain.com</param-value>
</init-param>
....
public class MyAction extends Action {
void someMethod() {
ServletContext context = this.getServlet().getServletContext();
String smtpServer = context.getInitParameter("mailServer");
}
}
Second problem:
Trying to use "locale" strings in ApplicationResources.properties files. I
know I can define one, and get to it with the struts ActionMessage or the
jsp tag <bean:write >. How can I get the value and read it into a string in
my action class.
e.g.: (in an Action class)
void someMethod() {
String messageSubject = // read from ApplicationResources.properties
}
Thanks in advance
Mike Mayer
(e-mail address removed)
files. My google skills must be out of whack, because this should be easy
enough to find
First problem:
I'm trying to read a param in web.xml. Here's a snippet of the web.xml and
the code I am using to try to read the value. Does this look like I'm on the
right track? Because smtpServer is null...
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>mailServer</param-name>
<param-value>smtp.mydomain.com</param-value>
</init-param>
....
public class MyAction extends Action {
void someMethod() {
ServletContext context = this.getServlet().getServletContext();
String smtpServer = context.getInitParameter("mailServer");
}
}
Second problem:
Trying to use "locale" strings in ApplicationResources.properties files. I
know I can define one, and get to it with the struts ActionMessage or the
jsp tag <bean:write >. How can I get the value and read it into a string in
my action class.
e.g.: (in an Action class)
void someMethod() {
String messageSubject = // read from ApplicationResources.properties
}
Thanks in advance
Mike Mayer
(e-mail address removed)