Struts 2
我们来看一下项目所需要的jar
配置web.xml
<!-- 配置Struts 2框架的核心Filter -->
<filter>
<filter-name>struts</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
<init-param>
<param-name>actionPackages</param-name>
<param-value>com.hopeteam.struts.action</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
在struts
testZeroAction.java的代码如下:
@Results({
@Result(name="success", type=NullResult.
@Result(name="error", type=NullResult.
})
}
}
tip ="Struts2 Zero Configuration测试成功";
}
}
success.jsp
<%@ page language="java" contentType="text/html; charset=GBK"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>success</title>
<meta. http-equiv="Content-Type" content="text/html; charset=GBK">
</head>
<body>
<s:property value="tip"/>
</body>
</html>
Struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
</struts>
让我们看看部署情况,在浏览器下输入
欢迎光临 黑色海岸线论坛 (http://bbs.thysea.com/) | Powered by Discuz! 7.2 |