Struts - Problem replacing arguments with compound messages inresource bundle file

Discussion in 'Java' started by John, Feb 21, 2008.

  1. John

    John Guest

    Hi everybody,
    I have a Struts Web Application and I have a problem with replacing
    the arguments in compound messages:

    I have an entry in my ApplicationResources.properties:

    message.intranet.zero-result=Sorry that your search did not return any
    results. {0}

    My JSP contains the following:

    <bean:message key="message.intranet.zero-result"/>

    and in my action I want to substitute the {0}-argument:

    ActionMessages messages = new ActionMessages();
    ......
    String[] moreMessages = new String[1];
    moreMessages[0] = "Hello";
    ActionMessage aMessage = new ActionMessage(msg, moreMessages);
    messages.add(ActionMessages.GLOBAL_MESSAGE, aMessage);
    saveMessages(request, messages);


    At runtime, the JSP compiles as follows:

    "Sorry that your search did not return any results. null"

    The value of the key is retrieved correctly from the properties-file;
    but, instead of the String "Hello" at {0}, the argument is null.
    What am I doing wrong?

    Thank you very much for your help,
    John
     
    John, Feb 21, 2008
    #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. William  Cole
    Replies:
    1
    Views:
    735
    Ryan Dillon
    Mar 3, 2005
  2. Dov MORYUSEF
    Replies:
    2
    Views:
    5,321
  3. Brian Donovan

    Replacing python: in syslog log messages

    Brian Donovan, Sep 5, 2003, in forum: Python
    Replies:
    1
    Views:
    400
    Jp Calderone
    Sep 6, 2003
  4. Eric Laberge

    Unnamed compound object as "buffer" arguments

    Eric Laberge, Sep 4, 2005, in forum: C Programming
    Replies:
    7
    Views:
    345
    Michael Wojcik
    Sep 9, 2005
  5. Rob Meade

    Replacing - and not Replacing...

    Rob Meade, Apr 5, 2005, in forum: ASP General
    Replies:
    5
    Views:
    293
    Chris Hohmann
    Apr 11, 2005
Loading...

Share This Page