第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

是按最簡(jiǎn)單的例子在寫的,但總是404.。

本人小白,剛?cè)雜truts2.之前用的2.5.17版,但是沒(méi)有blank。war。。所以回裝了2.3版本。但是實(shí)驗(yàn)最簡(jiǎn)單的action例子總是失敗。代碼如下:web.xml

<?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_4_0.xsd" id="WebApp_ID" version="4.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的實(shí)現(xiàn)類 struts2.5以前可能有所不同 -->
??? <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>???
<filter-mapping>
??? <filter-name>struts2</filter-name>
??? <!-- 攔截所有的url -->
??? <url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

struts.xml

<?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" strict-method-invocation="false">
??????? <!-- name action的名字,訪問(wèn)時(shí)使用helloworld.action訪問(wèn),class:實(shí)現(xiàn)類 -->
??????? <action name="helloworld" class="cn.xhcoding.action.HelloWorldAction">
??????????? <!-- 結(jié)果集,即action中SUCCESS返回的視圖 -->
??????????? <result>/result.jsp</result>
??????? </action>

??????? </package>
??? </struts>


action類

package cn.xhcoding.action;

import com.opensymphony.xwork2.ActionSupport;

public class HelloWorldAction extends ActionSupport {
?@Override
??? public String execute() throws Exception {
??????? System.out.println("正在執(zhí)行的Action");
??????? // 返回視圖 SUCCESS,這是框架定義
??????? return SUCCESS;
??? }
}

result.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>Action Result</title>
</head>
<body>
<h1>恭喜成功配置好基本的struts2環(huán)境</h1>
<h2>Hello World, I am Successful</h2>
</body>
</html>

index.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>Action Result</title>
</head>
<body>
<h1>index</h1>

</body>
</html>

.可以顯示

https://img1.sycdn.imooc.com//5b9cc6630001fb6408360520.jpg

https://img1.sycdn.imooc.com//5b9cc6640001a13a08160453.jpg


正在回答

1 回答

訪問(wèn)的網(wǎng)址有問(wèn)題吧?

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

是按最簡(jiǎn)單的例子在寫的,但總是404.。

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)