-
Nov 27th, 2006, 06:08 AM
#1
BindException errors lost
Hi,
I have a Controller than extends the SimpleFormController.
I have then overridden the onSubmit method as shown below
@Override
protected ModelAndView onSubmit ( HttpServletRequest request, HttpServletResponse response, Object command, BindException errors )
and within this method I am doing some validation..
When I detect a problem I am using the following code to add the error message to the BindException object and then attempt to display this error.
errors.reject ( "group.assign.selection.invalid");
//redisplay form with error message
return showForm ( request, response, errors );
group.assign.selection.invalid is defined in my messages.properties file, I have tried alternates but no noy.
In my jsp I am then binding on status.* and attempting to display the error messages that should be contained in status.errorMessages.
<c:if test="${!empty filter}">
<spring:bind path="filter.*">
<c:forEach items="${status.errorMessages}" var="msg">
<c:out value="${msg}" />
</c:forEach>
</spring:bind>
</c:if>
However, in my case the status.errorMessages is always empty ( I have added some debugging checks to the jsp). Now this *was* working for me a while back but has since stopped working.
Does anyone have any ideas why or any help in debugging this problem. Banging my head against a wall here..
Cheers
Mi3e.
Last edited by mi3e; Nov 28th, 2006 at 03:25 AM.
-
Nov 27th, 2006, 10:50 AM
#2
Some more info
It seems to be something to do with my build.
Another developer who is working on the project and has exactly the same environment builds a war in his system and he can see the error messages.
We're both using the same source control system, maven2 for builds and tomcat 5.5 .. I've tried using both firefox and IE and both exibit the same behaviour.
Its bizarre.
-
Nov 28th, 2006, 03:01 AM
#3
Problem fixed.
I got the .war for the same build from another developers machine and it worked fine so i examined the contents. In his WEB-INF\lib there was spring-2.0.jar along with a lot of the subjars such as spring-core-2.0.jar whereas within mine there was only the component jars. We were both using different maven2 repositories and when i switched to use his i also picked up the spring-2.0.jar and all worked fine.
So, i am reworking the .poms to find out what is pulling in the "top level" spring-2.0.jar, try to rework is so we don't and also get all the required dependencies..
So it has turned out to be a maven2 and dependency problem rather than a spring problerm per se. Still don't really understand how i was able to build and deploy without all the required dependencies but that may come to light in the next day or so.
Regards,
Mi3e.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules