Simple Struts question: how can I add the value of a bean variable to arg0 of the bean:message tag?

Discussion in 'Java' started by Thomas P. Fuller, Aug 16, 2004.

  1. Hi, any help with the following is much appreciated:

    I'd like to add the value of a bean variable into arg0 of the
    bean:message tag in the following way:

    The following works:

    <bean:write name="loginFormBean" property="userName"/>
    results in, for example,

    tfuller

    and

    <bean:message key="homepage.welcome.text"/>
    results in, for example:

    Welcome back {0}, we're happy to see you again!

    Now I need to figure out how I can do the equivalent of (this does NOT
    work):

    <bean:message key="homepage.welcome.text"
    arg0="loginFormBean.userName"/>

    which should give me:

    Welcome back tfuller, we're happy to see you again!

    I figure this should be pretty easy, but I'm having a bit of trouble
    with it; I'm new to Struts, so this is probably the reason why.

    Thanks,

    Thomas
    Thomas P. Fuller, Aug 16, 2004
    #1
    1. Advertising

  2. Thomas P. Fuller

    bitbucket43 Guest

    Re: Simple Struts question: how can I add the value of a bean variable

    Thomas P. Fuller wrote:
    <snip>
    > <bean:message key="homepage.welcome.text"
    > arg0="loginFormBean.userName"/>


    <bean:message key="homepage.welcome.text"
    arg0="<%= loginFormBean.userName %>" />
    bitbucket43, Aug 17, 2004
    #2
    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. jill
    Replies:
    5
    Views:
    15,571
  2. shruds
    Replies:
    1
    Views:
    779
    John C. Bollinger
    Jan 27, 2006
  3. gk
    Replies:
    0
    Views:
    2,082
  4. Replies:
    0
    Views:
    770
  5. Frank
    Replies:
    1
    Views:
    1,394
    Jonatan Kazmierczak
    Jan 23, 2008
Loading...

Share This Page