Struts2 配置文件全局result配置



Struts2 配置文件全局result配置 在使用struts2 web编程的时候,一些文件的execute返回值都是一样的,比如success,error,input,needslogin等等,如果每一项都要重新配置,就显得配置文件很繁琐,这里可以采用struts2的全局result配置。例如:





我项目中的配置:
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

abstract="true">

/jsp/myError.jsp
/jsp/crash.jsp
/jsp/needsLogin.jsp
/jsp/needsInit.jsp
/jsp/needsInit.jsp
extends="globalResult">

/jsp/index.jsp
/jsp/login.jsp


/jsp/left.jsp
/jsp/login.jsp

这样以后只需要配置success或者不同的error就可以了,配置文件看起来简洁不少呢。。