后台执行方法,网页报404错误
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<package name="default" namespace="/" extends="struts-default">
<action name="helloworld_*" method="{1}" class="com.imooc.action.HelloWorldAction">
<result>/result.jsp</result>
<result name="add">/{1}.jsp</result>
<result name="update">/{1}.jsp</result>
</action>
</package>
<constant name="struts.enable.DynamicMethodInvocation" value="false"></constant>
</struts>
package com.imooc.action;
import com.opensymphony.xwork2.ActionSupport;
public class HelloWorldAction extends ActionSupport{
@Override
public String execute() throws Exception {
System.out.println("执行Action");
return SUCCESS;
}
public String add(){
System.out.println("执行add");
return "add";
}
public String update(){
System.out.println("执行upate");
return "update";
}
}
HTTP Status 404 - /HelloWorld/add.jsp
type Status report
message /HelloWorld/add.jsp
description The requested resource is not available.