Struts Validator - Bundles

Discussion in 'Java' started by Paul, Oct 8, 2003.

  1. Paul

    Paul Guest

    It seems Struts FORCES me to have all my validation keys and error
    keys in the main bundle (commonly known as ApplicationResources.xml).

    I want to have these keys in a different bundle. Is that possible? The
    Java doc API says there is a bundle property to the Argument and Msg
    class, but those aren't listed in the DTD.

    Am I correct?
     
    Paul, Oct 8, 2003
    #1
    1. Advertising

  2. Paul

    Sudsy Guest

    Paul wrote:
    > It seems Struts FORCES me to have all my validation keys and error
    > keys in the main bundle (commonly known as ApplicationResources.xml).
    >
    > I want to have these keys in a different bundle. Is that possible? The
    > Java doc API says there is a bundle property to the Argument and Msg
    > class, but those aren't listed in the DTD.
    >
    > Am I correct?


    Take a look at the docs for the html:errors and html:messages tags.
    You can set the bundle name there. And since they have rtexprvalue
    set to true you, can even do things like this:
    <html:messages bundle="<%= bundleName %>"/>

    Amuse yourself for hours!
     
    Sudsy, Oct 9, 2003
    #2
    1. Advertising

  3. Paul

    Sudsy Guest

    Paul wrote:
    > It seems Struts FORCES me to have all my validation keys and error
    > keys in the main bundle (commonly known as ApplicationResources.xml).
    >
    > I want to have these keys in a different bundle. Is that possible? The
    > Java doc API says there is a bundle property to the Argument and Msg
    > class, but those aren't listed in the DTD.
    >
    > Am I correct?


    Oops...I may have assumed too much. You need an additional tag
    in your struts-config.xml file. Add a line like this after the
    default one:
    <message-resources null="false" parameter="ValidationMessages"
    key="bundleName"/>
     
    Sudsy, Oct 10, 2003
    #3
    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. M Series
    Replies:
    0
    Views:
    353
    M Series
    Oct 20, 2003
  2. Vyom

    Problem with Bundles

    Vyom, Oct 12, 2004, in forum: Java
    Replies:
    0
    Views:
    309
  3. Replies:
    4
    Views:
    12,014
  4. Replies:
    0
    Views:
    406
  5. Replies:
    4
    Views:
    903
    Richter~9.6
    Feb 13, 2007
Loading...

Share This Page