Results 1 to 4 of 4
  1. #1
    yuchuang is offline Member
    Join Date
    Apr 2007
    Location
    Singapore
    Posts
    29
    Rep Power
    0

    Default struts properties

    If in my properties page, i have a line like

    msg.publisher.rp.publish.success=The research paper {0} has been successfully published

    then how do i display the {0} to the value i want on my page? Anyone knows?

    Thank you!

  2. #2
    goldhouse is offline Senior Member
    Join Date
    Mar 2007
    Posts
    134
    Rep Power
    0

    Default Reading from properties

    I understand here you use the struts.properties as just a properties file
    You can read it as below.
    Reading a properties file

    Or in the Struts
    Java Code:
    import org.apache.struts.util.MessageResources;
    ...
    private MessageResources messages = MessageResources.getMessageResources("struts.properties");
    String message = messages.getMessage("my.message");
    then
    message.replaceAll the {0} withe the value.

    Did I answer the question ?

  3. #3
    pegitha is offline Member
    Join Date
    Apr 2007
    Location
    Indiana
    Posts
    83
    Rep Power
    0

    Default

    here is how I use it, but I am not using struts 2. Not sure what version you are using.
    Java Code:
     ActionMessages message = new ActionMessages();
       message.add("msg.publisher.rp.publish.success", new ActionMessage("msg.publisher.rp.publish.success", "Success"));

  4. #4
    yuchuang is offline Member
    Join Date
    Apr 2007
    Location
    Singapore
    Posts
    29
    Rep Power
    0

Similar Threads

  1. Getting .mp3 properties
    By Leprechaun in forum New To Java
    Replies: 1
    Last Post: 02-06-2008, 06:55 AM
  2. retrieving Properties
    By bugger in forum New To Java
    Replies: 1
    Last Post: 01-13-2008, 10:44 PM
  3. Getting System Properties
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-19-2007, 06:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •