We can define through struts.xml an action that response when we get an unavailable resource

For example if we get http://localhost:8080/helloworld  but helloworldAction doesn’t exist generally we obtain an 404 error

Using following configuration

<default-action-ref name="home" />
			<result name="success">/jsp/main.jsp</result>
			<result name="login" type="redirect">/login.html</result>
			<result name="error" type="redirect">/404.html</result>
			<exception-mapping exception="java.lang.Throwable"
				result="error" />

In this way when we get an unavailable resource the framework run the home action as default

Share →

Leave a Reply

Your email address will not be published. Required fields are marked *