Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6963883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:51:09+00:00 2026-05-27T15:51:09+00:00

I have tried to pass dynamic parameters to keyvalue(message to display) which I will

  • 0

I have tried to pass dynamic parameters to keyvalue(message to display) which I will get from package.properties to the Action class through the getText() method. To get the message, we can use getText(String keyvalue) method. What should I do to pass some parameters and retrieve the parameters with the message through the getText() method?

I saw some API’s to pass dynamic parameters. But I don’t know how to use, these are the following API’s, click here to see the Struts 2 API Documentation.

  1. getText(String aTextName, List<Object> args)
  2. getText(String key, String[] args)
  3. getText(String key, String defaultValue, String[] args)

Thanks in advance..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:51:10+00:00Added an answer on May 27, 2026 at 3:51 pm

    I suppose that you have following properties in your package.properties

    1. username.required=user name is required
    2. password.required=password is required

    you can use getText() as

    getText("username.required")
    getText("password.required")
    

    Now if we want to use getText(String key, String[] args) we have to pass following parameters

    aTextName - the resource bundle key that is to be searched for

    args - a list args to be used in a MessageFormat message

    That means the message format pattern and other static strings will, of course, be obtained from resource bundles. Other parameters will be dynamically determined at runtime.
    example
    we have following entry in resource file

    disk.data=The disk \"{0}\" artist name is {1}.
    

    in this {1} and {0} are the dynamic parameters and will be determined at run time so args will contain the value of these parameters.

    String artistName= demo;
     String diskName = "Artist";
     String[] testArgs = {artistName, diskName};
    

    So final call will be getText(disk.data, testArgs);
    and it will show

    The disk demo artist name is Artist.
    

    Please go through MessageFormat to know how this work

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dynamic php page which I need to call with a get
I am trying to pass a variable within a header link. I have tried
I have tried some ways to use LINQ dynamic queries - LINQKit and LINQ
I have the following dynamic query which is working fine without the WHERE clause,
I have the following jquery code which loads the #content div from another page,
I wanted to make a dynamic method in which i pass any instance of
I have a Stored Procedure (SP) in which I pass in one value. In
I have an asp.net application where I need to pass values from one modal
Have tried to find solutions for this and can't really come up with anything.
I have tried var dateHeaders = HttpContext.Current.Request.Headers[Date] but it contains null, apparently there is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.