为了账号安全,请及时绑定邮箱和手机立即绑定

这节课的代码

<?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.sycdn.imooc.com/5b16afed0001701502530269.jpg

2018-06-05 源自:Struts2入门 2-2 743 浏览 2 回答

厉害厉害

2018-06-08
回复 0

lihailihai

2018-06-08
回复 0

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信