Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
<form:label/> should have MessageSource support [SPR-2566] #7255
(c.f. comment from Matt Raible on #7043)
It would be cool if this tag supported a "key" attribute so you could read directly from your messageSource. For example:
<form:label path="firstName" key="user.firstName"/>
Just a thought.
Affects: 2.0 RC3
15 votes, 12 watchers
Jared Stehler commented
Also, it would be really cool and helpful if you could add the additional functionality found in the appFuse labelTag for linking with the commons validator to show if a field is required, and/or errors which have been reported on that field.
It does so by grabbing a ValidatorFactory from the webApplicationContext, and getting the ValidatorResources from there... I am using a slightly modified version of this tag, as I have multiple layers of validation and therefore multiple validator factory beans defined (for differing webFlows, etc), so I wanted the ability to specify the validator resources that I wanted the label tags to use. I ended up storing the string name of the particular flow's validator factory bean in the flowScope on the initial state of the webflow, and changing LabelTag.getValidatorResources() as follows:
Each flow defines its own WizardAction bean, injecting the name of its particular validator factory bean, which in turn is defined with its own validation.xml file.
It turns out you cant store a ValidatorResources object in flowScope, since although it claims to be serializable, after you run one validation with it, it stores references to Method objects, which are not, and you get nasty conversation errors.