我尝试创建一个新的操作类并将其添加到struts.xml
,操作类成功编译,但是当我运行 tomcat 时,它在索引页面本身显示 The requested resource is not available 404 错误。
创建用户.jsp
<s:form action = "CreateUserAction" >
<s:textfield name = "name" label = "Name" />
<s:textfield name = "userName" label = "User Name" />
<s:submit value = "Register" />
</s:form>
CreateUserAction.java
public String execute() {
setMessage("Hello " + getUserName());
return "SUCCESS";
}
Struts.xml
<package name="default" extends="struts-default">
<action name="CreateUserAction" class="com.ecommerce.action.CreateUserAction">
<result name="SUCCESS">/success.jsp</result>
</action>
</package>