struts2默认action
struts.xml文件的某个package中添加<default-action-ref name="error"></default-action-ref>
<package name="index" namespace="/" extends="struts-default"> <default-action-ref name="error"></default-action-ref> <action name="error" class="cn.orlion.actions.StudentsAction" method="error"> <result> /404.jsp </result> </action> </package>
这样当访问不存在的action时就会请求设置的默认的action如:http://localhost:8080/Struts2Demo/dawdawdawdawdawd.action