Hi, On Tue, Nov 15, 2011 at 8:09 PM, Jablow, Eric R <[email protected]> wrote: > I'm trying to use the wicketstuff.org JSR-303 validation project to use > Hibernate Validator in my > newish Wicket project. > > I have a FormComponentPanel with a model object set up for JSR-303 > validation, but we are > using vanilla Wicket Validators for it. To test the FormComponentPanel, I > wrote a test panel > which includes a form, which includes the FormComponentPanel. When I add the > WicketStuff > PropertyValidation behavior to the test panel (which I then use with a > WicketTester > based JUnit test class): > > //CategoryTestPanel > Form<Marking> form = new Form<Marking>("form", new > CompoundPropertyModel<Marking>(marking)); > form.add(new PropertyValidation()); > add(form); > form.add(new CategoryPanel("category")); > form.add(new Button("submit")); > > and > > //CategoryPanelTest > @Before > public void initTester() { > tester = new WicketTester(); > tester.startPanel(CategoryTestPanel.class); > formTester = tester.newFormTester("form"); > } > > I get this exception: > > org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy > after render phase has started (page version cant change then anymore) > at > org.apache.wicket.Component.checkHierarchyChange(Component.java:3521) > at > org.apache.wicket.Component.addStateChange(Component.java:3450) > at org.apache.wicket.Behaviors.add(Behaviors.java:62) > at org.apache.wicket.Component.add(Component.java:4431) > at > org.apache.wicket.markup.html.form.FormComponent.add(FormComponent.java:490) > at > org.wicketstuff.jsr303.PropertyValidation.addValidator(PropertyValidation.java:76) > at > org.wicketstuff.jsr303.PropertyValidation.access$000(PropertyValidation.java:17) > at > org.wicketstuff.jsr303.PropertyValidation$JSR303ValidatorFormComponentVisitor.component(PropertyValidation.java:32) > at > org.wicketstuff.jsr303.PropertyValidation$JSR303ValidatorFormComponentVisitor.component(PropertyValidation.java:22) > ***redacted***
You cut the interesting part of the stack trace. > > Note that vlaidators are already being added to the FormComponentPanel > object, and they work fine. Where should I add the validation behavior? Is > there a better JSR303 library to use (inside a public Maven repository)? See https://github.com/42Lines/wicket-bean-validation http://repo1.maven.org/maven2/net/ftlines/wicket-bean-validation/ > > 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. > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
