Struts Validator - Bundles

P

Paul

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?
 
S

Sudsy

Paul said:
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!
 
S

Sudsy

Paul said:
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"/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
ClayE7480

Latest Threads

Top