Struts 2 Writing global results

            Most often, results are nested with the action element. But some results apply to multiple actions. In a secure application, a client might try to access a page without being authorized, and many actions may need access to a "logon" result.

            If actions need to share results, a set of global results can be defined for each package. The framework will first look for a local result nested in the action. If a local match is not found, then the global results are checked.

Global result configurations

			<result name="home">home.jsp</result>

Complete struts.xml

<?xml version="1.0" encoding="UTF-8"?>

"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"

<constant name="struts.enable.DynamicMethodInvocation" value="true" />
	<package name="com" extends="struts-default">

			<result name="home">home.jsp</result>

		    <action name="*User" method="{1}" class="com.candidjava.controller.UserAction">
            <result name="success">/success.jsp</result>






        Struts 2 global results war

        Struts 2 global results maven zip

Related Post