Announcement Announcement Module
Collapse
No announcement yet.
[spring3] how to disable default MVC model validation? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [spring3] how to disable default MVC model validation?

    i am writing a JSONView

    but the modelmap contains additional validationresult objects other than the ones returned from my controller

    Code:
    public class JSONView implements View {
        ....
    
        public void render(Map<String, ?> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
            response.setContentType(getContentType());
            String json = serializer.serialize(rawModel);
            response.getWriter().write(json);
        }
    }

    how to exclude the auto validation objects from the model
    Last edited by verydapeng; Nov 1st, 2009, 09:34 PM. Reason: text format

  • #2
    Originally posted by verydapeng View Post
    i am writing a JSONView

    how to exclude the auto validation objects from the model
    I've noticed the same thing. I took a look at the code, and it seems that all objects will be validated, except for Collections and arrays. A workaround is wrapping your objects in a collection or array.

    It would be good to have a way of disabling validation altogether!

    Roel

    Comment

    Working...
    X