since we use wicket's localization to resolve errors (which allows you
to override them on component/page/foo) level we have to use wicket's
placeholder syntax which is ${key} instead of {key}. fix that in your
message and you will be fine.-igor On Wed, Nov 16, 2011 at 8:23 AM, Jablow, Eric R <[email protected]> wrote: > > > From: Martin Grigorov [mailto:[email protected]] >>Hi, > >>Looking at the stacktrace I think you should add this line to Wicket's >>resource bundle. Just add it to YourApplication.properties and it should be >>fine. > > I'm a lot closer to fine, now. However, I think I've exposed a usability > problem with the net.ftlines.wicket-bean-validation project. I put the > Hibernate validation properties into the WicketTester's application in the > test class (since it does not recognize the properties from the surrounding > web project): > > @BeforeClass > public static void initValidation() { > conf = new ValidationConfiguration(); > } > > @Before > public void initTester() { > tester = new WicketTester(); > WebApplication application = tester.getApplication(); > List<IStringResourceLoader> stringResourceLoaders = > application.getResourceSettings().getStringResourceLoaders(); > // My custom messages from a project this depends on. > stringResourceLoaders.add(new > BundleStringResourceLoader("ValidationMessages")); > // The messages from the Hibernate Validator jar. > stringResourceLoaders.add(new > BundleStringResourceLoader("org.hibernate.validator.ValidationMessages")); > conf.configure(application); > tester.startPanel(NCategoryTestPanel.class); > formTester = tester.newFormTester("form"); > } > > When this validates a field that violates an @Size(min=3, max=4) annotation, > the message that comes out is: > size must be between {min} and {max} > > The Hibernate validator running on its own interpolates the values of min and > max from the annotation, and it would give the error message. > size must be between 3 and 4 > I'm verified that in testing of the POJOs and their HibernateValidator. I do > have to suggest that the messages somehow be obtained from the Hibernate > Validator framework, and not from pure Wicket. Also, the validator can be > driven either by annotations or by an XML file, and so one cannot depend on > the annotations to actually exist. > > Respectfully, > Eric Jablow > > This communication, along with any attachments, is covered by federal and > state law governing electronic communications and may contain company > proprietary and legally privileged information. If the reader of this > message is not the intended recipient, you are hereby notified that any > dissemination, distribution, use or copying of this message is strictly > prohibited. If you have received this in error, please reply immediately to > the sender and delete this message. Thank you. > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
