Results 1 to 2 of 2

Thread: onSubmit?

  1. #1

    Cool 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

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

    Code:
    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. #2
    Join Date
    Jul 2005
    Location
    Russia
    Posts
    118

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •