-
Sep 15th, 2010, 02:26 PM
#1
Spring MVC 3 Error suggestions
I am currently using spring's form taglib and am displaying errors when received back from the server and it works great:
Code:
<form:errors path="*"/>
What does everyone do for ajax errors? Do you just plug them into about the same spot, use error codes, or ...?
Thanks
-
Sep 28th, 2010, 12:30 PM
#2
-
Sep 28th, 2010, 12:41 PM
#3
When you say AJAX errors..are you referring to async calls made to the server? If so Shouldn't they be handled/processed in the same way your other validation calls are happening?
-
Sep 28th, 2010, 02:55 PM
#4
yes, asynch. I'm unsure how to plug them into springs taglibs. When I receive them back from the server-side I get them in JSON format.
Currently what I do is have a set of errors that exist in separate divs (that are invisible) and have a error code associated with each. When i receive an error from the server I just make the div with the proper error code appear. That is just for JSON, for everything else I use spring's form:errors taglib.
But I was interested in how other people handled it and if there was a cleaner way?
-
Sep 28th, 2010, 03:01 PM
#5
In my case all calls , sync and async are validated by the same validators and are accessed on the jsp using form:errors (i don't use a separate response mechanism for async calls but rather use the same mvc model object paradigm to propagate errors). I dont use divs etc to show hide dynamically but rather use tiles+Spring JS/AJAX to reload specific parts of the page (in the case of a async all). This way all my requests/response are handled in the same way and the error validation is also central.
-
Sep 29th, 2010, 08:57 AM
#6
ah yeah, I forgot about that. I didn't mention I was on Portlet MVC, but I forgot that there are parts (like the marshaller) the portlet code can't use.
Interesting on the Spring JS, haven't checked that out. Thanks!
Tags for this Thread
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