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

  • Error Handling

    Hi ,

    I am trying to used transition on error using Spring Frame work. The following is the code which I am using to test the same:

    The XML is below:

    <action-state id="Add">
    <action bean="addDriver" method="isUpdateDriver" />
    <transition on="updateDriver" to="Update" />
    <transition on="error" to="addDriver" />
    <transition on-exception ="java.lang.Exception" to = "errorHandler"/>

    The method is shown below

    public Event updateDriver (RequestContext request) throws Exception

    boolean checkerror = true;
    //Build the beans required for calling the Business Processor
    System.out.println("In updateDriver");
    BeanMapper objBeanMapper = new NBDriverBeanMapper ();
    Object [] requestlistobject=objBeanMapper.prepareRequestBean s(request);

    BusinessProcessMapper objBSMapper = new BusinessProcessMapper();
    Hashtable responselistobject = objBSMapper.callBusinessProcessor(request, requestlistobject);
    //The output will be updated in response objects.
    objBeanMapper.prepareResponseBeans(request, responselistobject);

    throw new Exception();
    //return success ();

    But the control is not going to errorHandler as expected. But it gets thrown in screen!!! Am I doing anything wrong?? Any help in this welcome...

  • #2
    I'm not really sure I can follow what's going on here. The action-state you pasted invokes the isUpdateDriver method, but you pasted in the updateDriver method???



    • #3
      My application is using spring MVC + Spring Webflow and in that case when i am going to reder a flow which is using ajax the application timeout occurs and i am handling the exception occured during timeout in flow handler . During this exception i am trying to redirect the flow to the default flow within Abstractflow handler using the following code.
      public String handleException(FlowException flowException, HttpServletRequest request, HttpServletResponse response) {
      Exception exception = (Exception)findRootCause(flowException.getCause()) ;
      String errorCode = null;
      if (flowException instanceof NoSuchFlowExecutionException) {
      BookingException bookingException=new BookingException(flowException);
      request.setAttribute(WebKeys.BUSINESS_ERROR,bookin gException );
      return "/ibe/login";
      return "/ibe/booking";

      In the normal flow it gets redirected to the given url but in the case of ajax flow its adding &fragments"somename" to the redirected URL so the url becomes "/ibe/login&fragments omename". Why this is happening.

      Due to this issue i am not able to render a viw while application timeout occurs in ajax flow.


      • #4

        What is the difference between error checking using if..else and using exception handling?


        • #5
          I want to know how the redirect can be done while in the case of an ajax call in spring web flow.