在上一篇中我们完成了action的编写,但是在实际调用中并不是直接调用函数方法,而是在一个特殊的文件中对action进行声明调用,一般来说这个阶段和前端编写、action函数编写是在同一个过程,但是篇幅问题,我将之拆成三部分,这一部分是三分之一xml文件编写。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<package name="com" namespace="/" extends="struts-default">
<action name="edt" class="action.empaction" method="editEmp">
<result name="success">index.jsp</result>
<result name="error">error.jsp</result>
</action>
<action name="listAll" class="action.empaction" method="listAll">
<result name="success">index.jsp</result>
<result name="error">error.jsp</result>
</action>
<action name="del" class="action.empaction" method="deleteEmp">
<result name="success">index.jsp</result>
<result name="error">error.jsp</result>
</action>
<action name="add" class="action.empaction" method="addEmp">
<result name="success">index.jsp</result>
<result name="error">error.jsp</result>
</action>
<action name="toAdd" class="action.empaction" method="toAdd">
<result name="success">add.jsp</result>
<result name="error">error.jsp</result>
</action>
<action name="slt" class="action.empaction" method="selectEmp">
<result name="success">update.jsp</result>
<result name="error">error.jsp</result>
</action>
<action name="test" class="action.empaction" method="Test">
<result name="success">error.jsp</result>
<result name="error">error.jsp</result>
</action>
</package>
</struts>
直接导入包的时候struts-default会报红,直接改一下
方法如下https://blog.csdn.net/weixin_41060905/article/details/82872737