总是跳到/error.jsp页面
我是接着上章的内容写的,没有开新的项目工程
struts里用的引用其他的配置文件,点击链接总是跳转到/error.jsp页面
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <include file="helloworld.xml"></include> <package name="default" namespace="/" extends="struts-default"> <!-- 注册拦截器 --> <interceptors> <interceptor name="mytime" class="com.imooc.timer.TimerInterceptor"></interceptor> </interceptors> <action name="timer" class="com.imooc.timer.TimeAction"> <result>/succes.jsp</result> <!-- 引用拦截器 --> <interceptor-ref name="mytime"></interceptor-ref> </action> </package> </struts>
<!-- helloworld.xml --> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"> <struts> <!-- <constant name="struts.action.extension" value="html"></constant> --> <package name="default" namespace="/" extends="struts-default"> <default-action-ref name="error"></default-action-ref> <action name="error"> <result >/error.jsp</result> </action> <action name="helloworld_*" method="{1}" class="com.imooc.action.HelloWorld"> <result>/result.jsp</result> <result name="add">/{1}.jsp</result> </action> <action name="loginaction" method="login" class="com.imooc.action.LoginAction"> <result>/succes.jsp</result> <result name="input">login.jsp</result> </action> </package> </struts>