2012-03-16 10:10:23.0|分类: struts|浏览量: 1417
When an action class method completes, it returns a String. The value of the String is used to select a result element. An action mapping will often have a set of results representing different possible outcomes. A standard set of result tokens are defined by the ActionSupport base class. action执行完,会返回一个string类型的数据,这个数据用于选择result element。 result:标准的配置集合已在action接口中定义: String SUCCESS = "success"; String NONE = "none"; String ERROR = "error"; String INPUT = "input"; String LOGIN = "login"; 当然用户可以自己定义result。 A special 'other' result can be configured by adding a result with name="*". This result will only be selected if no result is found with a matching name. <action name="Hello"> <result>/hello/Result.jsp</result> <result name="error">/hello/Error.jsp</result> <result name="input">/hello/Input.jsp</result> <result name="*">/hello/Other.jsp</result> </action>
注:(1)“*”并不是通配模式,而是如果找不到相应的name,就会选择name=* (2)在大部分情况下,如果找不到相应的name,就会抛出错误 |