标签:extend eth namespace oid welcome pre world 工程 height
WEB-INF:文件夹下web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>helloworld</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- 配置核心拦截器-->
<filter>
<!-- Filter的名字-->
<filter-name>struts2</filter-name>
<!-- Filter的实现类struts2.5以前可能有所不同-->
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<!--拦截所有的url -->
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
WebContent文件夹下:
inputMessage.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>input message page</title>
</head>
<body>
<form action="helloworld.action" method="post">
Message:<input name="message" type="text">
<input type="submit"value="提交">
</form>
</body>
</html>
nomessage.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>noMessage</title>
</head>
<body>
no message was input!
</body>
</html>
showmessage.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>show message page</title>
</head>
<body>
the input message is: <s:property value="message" />
</body>
</html>
运行结果:
标签:extend eth namespace oid welcome pre world 工程 height
原文地址:https://www.cnblogs.com/xiaobo-Linux/p/9029556.html