Announcement Announcement Module
Collapse
No announcement yet.
on-exception : how to show a customize error message Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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.

    Comment


    • #3
      thanks

      Hello jandrla

      it works, thanks so much

      god bless you

      regards

      Comment

      Working...
      X