王飞燕
2016-06-09 11:47
<?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.
浏览器地址栏应该这样输入:127.0.0.1:8080/你的工程名/helloworld_add
Struts2入门
95062 学习 · 456 问题
相似问题