Struts2 第一讲

public class HelloWorldAction implements Action{

	@Override
	public String execute() throws Exception {
		System.out.println("执行了Action的默认方法");
		return SUCCESS;
	}

}
helloWorld.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>Insert title here</title>
</head>
<body>
Struts2大爷你好!
</body>
</html>
<?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>
	
  <package name="helloWorld" extends="struts-default">
  	<action name="hello" class="com.java1234.action.HelloWorldAction">
  		<result name="success">helloWorld.jsp</result>
  	</action>
  	
 
  </package>

</struts>



阅读更多
换一批

没有更多推荐了,返回首页