[ http://jira.andromda.org/browse/BPM-245?page=comments#action_11965 ] Wouter Zoons commented on BPM-245: ----------------------------------
are you saying you or /only/ saving the exception message ? you're /not/ throwing an exception ? in that case the behavior is normal some people want to forward error messages in specific cases, without having to deal with the handling of exceptions you should just throw an exception and let Struts handle it, the default behavior is to return to the input page if saving an error message made the webapp return to the input page in one of the earlier AndroMDA versions than that was a bug > saveErrorMessages don't work anymore > ------------------------------------ > > Key: BPM-245 > URL: http://jira.andromda.org/browse/BPM-245 > Project: Bpm4Struts Cartridge > Type: Bug > Versions: 3.1M1 > Environment: JDK 1.5, Struts 1.2.7, Windows XP Pro > Reporter: Bobby Peterson > Assignee: Wouter Zoons > Priority: Critical > > After upgrading to 3.1 I have had many problems with the error messages and > validation. The custom validation is still not working. In the controller > methods I call saveErrorMessage given it the request and a valid message key. > The error is saved into the session but the flow of the application > continues to go to the next action state, JSP which causes major problems > because an error has occured. > With some investigation I found that the code generated in 3.0 wrapped the > next call in an if block like the following: > if (this.errorsNotPresent(request)) > { > forward = _retrieveData(mapping, form, request, response); > } > in 3.1 the code looks like: > forward = _retrieveData(mapping, form, request, response); > Is there a reason this change was made? Did I not set a property? If so, > shouldn't the old behavior be the default? > Thanks for the help or the fix. > The complete methods are below: > ############################################### 3.0 > ########################################### > ActionForward forward = null; > private ActionForward _detailsOk(ActionMapping mapping, ActionForm form, > HttpServletRequest request, HttpServletResponse response) throws Exception > { > ActionForward forward = null; > final org.apache.struts.action.ActionMessages errors = > this.getExceptionHandlerErrors(request); > try > { > if (this.errorsNotPresent(request)) > { > > PlanControllerFactory.getPlanControllerInstance().saveDetails(mapping, > DetailsSummarySaveDetailsFormImpl)form, request, response); > } > if (this.errorsNotPresent(request)) > { > forward = _retrieveData(mapping, form, request, response); > } > } > catch (Exception ex) > { > final String messageKey = > org.andromda.presentation.bpm4struts.PatternMatchingExceptionHandler.instance().handleException(ex); > > errors.add(org.apache.struts.action.ActionMessages.GLOBAL_MESSAGE, new > org.apache.struts.action.ActionMessage(messageKey)); > } > finally > { > } > if (!errors.isEmpty()) > { > forward = mapping.getInputForward(); > } > return forward; > } > ###################################### 3.1 > ######################################################### > private org.apache.struts.action.ActionForward > _detailsOk(org.apache.struts.action.ActionMapping mapping, > org.apache.struts.action.ActionForm form, > javax.servlet.http.HttpServletRequest request, > javax.servlet.http.HttpServletResponse response) throws java.lang.Exception > { > org.apache.struts.action.ActionForward forward = null; > try > { > > com.sys.uswdss.web.planning.plan.PlanControllerFactory.getPlanControllerInstance().saveDetails(mapping, > (DetailsSummarySaveDetailsFormImpl)form, request, response); > forward = _retrieveData(mapping, form, request, response); > } > catch (java.lang.Exception exception) > { > final java.lang.String messageKey = > org.andromda.presentation.bpm4struts.PatternMatchingExceptionHandler.instance().handleException(exception); > > com.sys.uswdss.web.planning.plan.PlanControllerFactory.getPlanControllerInstance().saveErrorMessage(request, > messageKey); > throw exception; > } > return forward; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.andromda.org/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Andromda-devel mailing list Andromda-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/andromda-devel