Announcement Announcement Module
No announcement yet.
onSubmit? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • onSubmit?

    I created my controller using some tutorial example, and there is some final part of code that I'm not sure how to interpret

    Map model = new HashMap();
    		model.put("error", "project " + projectNameCommand.getNazwaProjektu() + " doesn't exist");
    - in this part I put detected errors to my model HashMap

    return this.showForm(request, response, errors, model);
    - but what about this. Do I suppose to have some view ( for errors ) to display those errors. If yes, how to call that view. If no, can anybody tell me how to resolve that
    thx...a lot

  • #2
    In fact, this is not the best solution, you better use Validator instead.
    Your "error" object is a simple model property, so you should display it yourself. Something like this:
    <c:out value="${error}"/>.
    But usually you want to show errors after the form submission, and Validator approach is the best choice for doing this.