Results 1 to 3 of 3

Thread: handling exception in formBackingObject

  1. #1
    Join Date
    Aug 2004
    Posts
    8

    Default handling exception in formBackingObject

    what is the proper way to handle an exception in formBackingObject of my subclass of SimpleFormController?

    currently I retrieve some data to be displayed in this method and the data layer may throw an exception. I would like to catch it and then display it on a page. i.e.:


    protected Object formBackingObject(HttpServletRequest request) throws Exception {

    String orderId = RequestUtils.getRequiredStringParameter(request, "orderId");

    try {
    return (Order)service.getOrder(orderId);
    } catch (LockedException e) {
    //what to do now?
    }
    }

  2. #2
    Join Date
    Aug 2004
    Location
    San Jose, CA
    Posts
    24

    Default ModelAndViewDefiningException

    The only thing you can really do is eat the exception (bad) or throw a new exception. You might want to take a look at org.springframework.web.servlet.ModelAndViewDefini ngException. This allows to to specify a model and view to "handle" your exception.

  3. #3
    Join Date
    Aug 2004
    Posts
    8

    Default Re: ModelAndViewDefiningException

    I think this will help me a lot. Thank you.

Similar Threads

  1. Replies: 1
    Last Post: Oct 4th, 2005, 06:11 PM
  2. Context initialization failed
    By kanonmicke in forum Container
    Replies: 7
    Last Post: Sep 29th, 2005, 12:35 AM
  3. Replies: 0
    Last Post: Jul 11th, 2005, 05:49 PM
  4. Replies: 6
    Last Post: May 17th, 2005, 11:38 PM
  5. Replies: 3
    Last Post: Nov 8th, 2004, 07:30 PM

Posting Permissions

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