locale strings in struts

Discussion in 'Java' started by Mike Mayer, Apr 13, 2004.

  1. Mike Mayer

    Mike Mayer Guest

    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
     
    Mike Mayer, Apr 13, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Maurice Hulsman
    Replies:
    1
    Views:
    1,898
    Guus Bosman
    Jul 25, 2004
  2. Replies:
    4
    Views:
    1,033
  3. Gabriel Genellina
    Replies:
    0
    Views:
    728
    Gabriel Genellina
    Feb 18, 2009
  4. zade
    Replies:
    1
    Views:
    629
    James Kanze
    Mar 5, 2010
  5. Sibylle Koczian
    Replies:
    2
    Views:
    1,148
    Sibylle Koczian
    Nov 20, 2010
Loading...

Share This Page