这节课的代码

来源:2-2 Struts2 案例代码实现

qq_在雨中奔跑的男人_0

2018-06-05 23:44

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">

  <display-name>helloworld</display-name>

  <filter>

    <filter-name>struts2</filter-name>

    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>

  </filter>

   <filter-mapping>

   <filter-name>struts2</filter-name>

   <url-pattern>/*</url-pattern>

   </filter-mapping>

  <welcome-file-list> 

    <welcome-file>index.jsp</welcome-file>

  </welcome-file-list>

</web-app>



<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts PUBLIC

"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"

"http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>

 <package name="default" namespace="/" extends="struts-default">

     <action  name="helloworld" class="com.imooc.action.HelloWorldAction">

          <result>/result.jsp</result>

     </action>

   </package>

   </struts>


package com.imooc.action;


import com.opensymphony.xwork2.ActionSupport;


public class HelloWorldAction extends ActionSupport {


@Override

public String execute() throws Exception {

System.out.println("执行输出");

return SUCCESS;

}

}



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"

    pageEncoding="ISO-8859-1"%>

<!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=ISO-8859-1">

<title>Insert title here</title>

</head>

<body>

 this is a result.jsp

</body>

</html>




https://img3.mukewang.com/5b16afed0001701502530269.jpg

写回答 关注

2回答

  • whmi
    2018-06-08 08:47:58

    lihailihai

  • beautylsr
    2018-06-08 08:46:29

    厉害厉害

Struts2入门

本教程带你踏上Struts2学习之旅,对Struts2进行更深入讲解

95061 学习 · 456 问题

查看课程

相似问题