日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

Struts2 入門概述

系統 1993 0

Struts2 入門概述

?

Struts2 主要是通過導入struts2的jar包,通過Struts2的struts.xml配置 和struts的攔截器執行視圖文件,轉發到客戶端。

?

struts2部署

?

基本步驟:

?

1 新建web project?


Struts2 入門概述

?


Struts2 入門概述
?單擊"FINISH"完成。

?

?

2:導入struts2 jar包

?


Struts2 入門概述

?

?

3:配置project的web.xml文件

?

    <?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
 
 <!-- 配置瀏覽器傳遞URL的執行的WEB APPLICATION的配置值 -->
 <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>
 <login-config>
  <auth-method>BASIC</auth-method>
 </login-config>
</web-app>

  
?

?

4:配置project的struts2.xml文件

?

?

    <?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>
	<!-- 
    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="false" />

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

        <default-action-ref name="index" />

        <global-results>
            <result name="error">/error.jsp</result>
        </global-results>

        <global-exception-mappings>
            <exception-mapping exception="java.lang.Exception" result="error"/>
        </global-exception-mappings>

        <action name="index">
            <result type="redirectAction">
                <param name="actionName">HelloWorld</param>
                <param name="namespace">/example</param>
            </result>
        </action>
    </package>

    <include file="example.xml"/>
 	-->
    <!-- Add packages here -->
	
	<package name="default" namespace="/" extends="struts-default">
		<action name="helloworld">
			<result>/helloworld.jsp</result>
		</action>
	</package>
	
	
</struts>

  

?5:啟動應用服務器訪問項目

Struts2 入門概述


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 方正县| 交口县| 天镇县| 奉新县| 涿鹿县| 东丰县| 长海县| 蕲春县| 嵊泗县| 彰武县| 台南县| 什邡市| 即墨市| 平度市| 商南县| 新泰市| 瑞安市| 祥云县| 乌拉特前旗| 隆安县| 克什克腾旗| 二连浩特市| 利川市| 克拉玛依市| 漳州市| 个旧市| 固原市| 定陶县| 富民县| 宁强县| 子洲县| 阿坝| 大宁县| 武邑县| 东至县| 曲沃县| 抚松县| 弥渡县| 新邵县| 闽侯县| 新宾|