Hy,
I have a Webflow with a model that gets validated after submit.
The validation is correctly called and I add an errormessage to the MessageContext.
When i put the MessageContext in the requestScope i can display all errors (${messageContext.allMessages} ).
But I couldn't find out how to display the errormessages in the form with the Spring form:errors Tag.. the result is always empty.
jsp code looks like this :
and my validate Function:Code:<form:form modelAttribute="registerForm" action="${pageContext.request.scheme }://${pageContext.request.serverName }:${pageContext.request.serverPort }${flowExecutionUrl}"> <form:errors path="*" ></form:errors> <spring:bind path="firstName"> <input name="${status.expression}" type="text" value="${status.value}" > </spring:bind> <input type="submit" name="_eventId_submitRegistration" value="Submit" /> </form:form>
Code:public boolean validateRegister(MessageContext context) { MessageResolver msg = new MessageBuilder().error().source("registerForm.firstName").code("register.Field.missing").build(); context.addMessage(msg); context.addMessage(new MessageBuilder().error().source("firstName").code("register.Field.missing").build()); }


Reply With Quote
