locale strings in struts

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top