Results 1 to 3 of 3

Thread: on-exception : how to show a customize error message

  1. #1
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,791

    Default on-exception : how to show a customize error message

    Hello guys

    in this code
    Code:
    <action-state id="transaccioncompletacomprafacturaautohonda-dos">
    	<bean-action bean="idConcreteProcesoCompraFacturaImplManagerObjectTransactional"
               method="procesoUpdateCabeceraFacturaCompraandInsertarArticuloAutoBO">
    			<method-arguments>
    				<argument expression="${flowScope.cabeceraFacturaCompraCommand}"/>
    			</method-arguments>
    	</bean-action>
    	<transition on="success" to="transaccioncompletacomprafacturaautohonda-tres" />
    	<transition on-exception="com.modelo.excepciones.MyPrimaryKeyException"
                      to="transaccioncompletacomprafacturaautohonda-uno" />			
    </action-state>
    my on-exception transition works fine, it goes to the desired view-state
    the problem is how in the jsp rendered of the view-state
    how i can show a customize error message if the MyPrimaryKeyException
    was thrown?

    thanks in advanced
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  2. #2
    Join Date
    Jul 2006
    Posts
    109

    Default

    Hi,
    TransitionExecutingStateExceptionHandler is exposing the exceptions in flash scope, by name "rootCauseException".

    Try ${rootCauseException.message}, and you'll get you exception message.

    Also, you can for example do this:
    Code:
    <transition on-exception="com.modelo.excepciones.MyPrimaryKeyException"
                      to="transaccioncompletacomprafacturaautohonda-uno" >
          <set attribute="primaryKeyError" value="''" scope="flash"/> 
    </transition>
    and on view (JSP or whatever), you can test presence of "primaryKeyError" attribute and to show custom message.

    Regards.

  3. #3
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,791

    Thumbs up thanks

    Hello jandrla

    it works, thanks so much

    god bless you

    regards
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

Posting Permissions

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