<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-34  評(píng)論-1965  文章-0  trackbacks-0

    Struts作為MVC 2的Web框架,自推出以來不斷受到開發(fā)者的追捧,得到用廣泛的應(yīng)用。作為最成功的Web框架,Struts自然擁有眾多的優(yōu)點(diǎn):

    • MVC 2模型的使用
    • 功能齊全的標(biāo)志庫(kù)(Tag Library)
    • 開放源代碼

    但是,所謂“金無赤金,人無完人”,Struts自身也有不少的缺點(diǎn):

    • 需要編寫的代碼過多,容易引起“類爆炸”
    • 單元測(cè)試?yán)щy

    這些缺點(diǎn)隨著Web的發(fā)展越來越明顯。這就促生了Struts 2.0,它的誕生能很好的解決上述問題。 好啦,廢話就不多說了,現(xiàn)在就讓我們感受一下的Struts 2.0的魅力吧。

    1. 搭建開發(fā)和運(yùn)行環(huán)境
      1. 到Apache下載Struts 2.0包

      2. 打開Eclipse 3.2新建Web工程

        點(diǎn)擊菜單File\New\Project,出現(xiàn)如圖1所示對(duì)話框
        圖1 新建工程對(duì)話框
        圖1 新建工程對(duì)話框
        選擇Web\Dynamic Web Project,點(diǎn)擊“Next”,出現(xiàn)圖2對(duì)話框

        圖2 新建動(dòng)態(tài)Web工程對(duì)話框
        圖2 新建動(dòng)態(tài)Web工程對(duì)話框
        在“Project Name”中鍵入Struts2_HelloWorld,點(diǎn)擊“New”,出現(xiàn)以下對(duì)話框

        圖3 新建服務(wù)器運(yùn)行時(shí)對(duì)話框
        圖3 新建服務(wù)器運(yùn)行時(shí)對(duì)話框
        選擇“Apache\Apache Tomat v5.5”,點(diǎn)擊“Next”,出現(xiàn)以下對(duì)話框

        圖4新建服務(wù)器運(yùn)行時(shí)對(duì)話框
        圖4新建服務(wù)器運(yùn)行時(shí)對(duì)話框
        點(diǎn)擊“Finish”,關(guān)閉對(duì)話框。

      3. 將Struts 2.0 lib下的jar文件加到工程的構(gòu)建路徑(build path)

        圖5 Struts 2.0的lib目錄
        圖5 Struts 2.0的lib目錄
        按ctr+a全選,復(fù)制,再轉(zhuǎn)到Eclipse窗口,在“Project Explorer”子窗口中選中Struts2_HelloWorld\WebContent\WEB-INF\lib,然后粘貼。經(jīng)過Eclipse自動(dòng)刷新“Project Explorer”子窗口,剛才所粘貼的jar文件應(yīng)該會(huì)出現(xiàn)在Struts2_HelloWorld\Java Resources: src\Libraries\Web App Libraries下,如圖6所示:

        圖6 Project Explorer子窗口
        圖6 Project Explorer子窗口

      4. 打開web.xml文件,將其修改為以下代碼:
        <?xml?version="1.0"?encoding="ISO-8859-1"?>
        <!DOCTYPE?web-app?PUBLIC?"-//Sun?Microsystems,?Inc.//DTD?Web?Application?2.3//EN"?"http://java.sun.com/dtd/web-app_2_3.dtd">
        <web-app>
        ????
        <display-name>Struts?2.0?Hello?World</display-name>
        ????
        <filter>
        ????????
        <filter-name>struts2</filter-name>????????<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
        ????
        </filter>
        ????
        <filter-mapping>
        ????????
        <filter-name>struts2</filter-name>
        ????????
        <url-pattern>/*</url-pattern>
        ????
        </filter-mapping>
        ????
        <welcome-file-list>
        ????????
        <welcome-file>index.html</welcome-file>
        ????
        </welcome-file-list>
        </web-app>

      5. 新建struts.xml文件

        右鍵點(diǎn)擊,Struts2_HelloWorld\Java Resources: src,出現(xiàn)如圖7所示菜單
        圖7 新建Other菜單
        圖7 新建Other菜單
        點(diǎn)擊“Other”,出現(xiàn)新建對(duì)話框,如圖8所示

        圖8 新建對(duì)話框
        圖8 新建對(duì)話框
        點(diǎn)擊“Next”,出現(xiàn)新建文件對(duì)話框,如圖9所示

        圖9 新建文件對(duì)話框
        圖9 新建文件對(duì)話框
        在“File name”中鍵入sturts.xml,點(diǎn)擊“Finish”,然后將struts.xml的內(nèi)容修改為:

        <!DOCTYPE?struts?PUBLIC
        ????????"-//Apache?Software?Foundation//DTD?Struts?Configuration?2.0//EN"
        ????????"http://struts.apache.org/dtds/struts-2.0.dtd"
        >
        <struts>
        ????
        <include?file="struts-default.xml"/>
        </struts>

      6. 新建index.html文件

        右鍵點(diǎn)擊Struts2_HelloWorld\WebContent,出現(xiàn)如圖10所示的菜單
        圖10 新建Other菜單
        圖10 新建Other菜單
        點(diǎn)擊“Other”,出現(xiàn)新建對(duì)話框,如圖11所示

        圖11 新建對(duì)話框
        圖11 新建對(duì)話框
        選擇Web\HTML,點(diǎn)擊“Next”出現(xiàn)如圖12所示的對(duì)話框

        圖12 新建HTML頁(yè)面對(duì)話框
        圖12 新建HTML頁(yè)面對(duì)話框
        在“File Name”中鍵入index.html,點(diǎn)擊“Next”,出現(xiàn)如圖13所示的對(duì)話框

        圖13 模板選擇對(duì)話框
        圖13 模板選擇對(duì)話框
        點(diǎn)擊“Finish”,將index.html的內(nèi)容修改為以下內(nèi)容:

        <!DOCTYPE?HTML?PUBLIC?"-//W3C//DTD?HTML?4.01?Transitional//EN">
        <html>
        <head>
        <meta?http-equiv="Content-Type"?content="text/html;?charset=UTF-8">
        <title>Hello?World</title>
        </head>
        <body>
        <h3>Hello?World!</h3>
        </body>
        </html>

      7. 將應(yīng)用程序打包到tomcat上

        右鍵點(diǎn)擊Struts_HelloWorld,出現(xiàn)如圖14所示的菜單
        圖14 工程菜單
        圖14 工程菜單
        點(diǎn)擊“Export\WAR file”,出現(xiàn)如圖15所示的對(duì)話框

        圖15 輸出對(duì)話框
        圖15 輸出對(duì)話框
        選擇“Web\WAR file”,點(diǎn)擊“Next”,出現(xiàn)如圖16所示的對(duì)話框

        圖16 輸出路徑對(duì)話框
        圖16 輸出路徑對(duì)話框
        輸入war文件的路徑(如%tomcat%\webapps\Struts2_HelloWorld.war),點(diǎn)擊“Finish”關(guān)閉對(duì)話框。

      8. 啟動(dòng)tomcat,運(yùn)行應(yīng)用程序

        打開你的Internet Explorer,鍵入http://localhost:8080/Struts2_HelloWorld/,窗口輸出如圖17所示
        圖17 Hello World窗口
        圖17 Hello World窗口

    2. 第一個(gè)Struts 2.0應(yīng)用程序——Hello World
      1. 新建類包(package)

        右鍵點(diǎn)擊Struts2_HelloWorld\Java Resources: src,出現(xiàn)如圖18所示菜單
        圖18 新建菜單
        圖18 新建菜單"
        點(diǎn)擊“New\Package”,出現(xiàn)如圖19所示對(duì)話框

        圖19新建Java類包對(duì)話框
        圖19新建Java類包對(duì)話框
        在“Name”鍵入tutorial,點(diǎn)擊“Finish”關(guān)閉對(duì)話框。

      2. 新建HelloWorld.java文件

        右鍵點(diǎn)擊Struts2_HelloWorld\Java Resources: src\tutorial,出現(xiàn)如圖20所示菜單
        圖20 新建菜單
        圖20 新建菜單
        點(diǎn)擊“New\Class”,出現(xiàn)如圖21所示對(duì)話框

        圖21 新建Java類對(duì)話框
        圖21 新建Java類對(duì)話框
        在“Name”中鍵入HelloWorld,在“Superclass”中鍵入com.opensymphony.xwork2.ActionSupport,點(diǎn)擊“Finish”關(guān)閉對(duì)話框。將HelloWorld.java的內(nèi)容修改為:

        package?tutorial;

        import?com.opensymphony.xwork2.ActionSupport;

        public?class?HelloWorld?extends?ActionSupport?{
        ????
        private?String?name;
        ????
        ????
        public?String?getName()?{
        ????????
        return?name;
        ????}

        ????
        ????
        public?void?setName(String?name)?{
        ????????
        this.name?=?name;
        ????}

        ????
        ????
        public?String?execute()?{
        ????????name?
        =?"Hello,?"?+?name?+?"!";?
        ????????
        return?SUCCESS;
        ????}

        }

      3. 在struts.xml中添加action映射(mapping)
        <!DOCTYPE?struts?PUBLIC
        ????????"-//Apache?Software?Foundation//DTD?Struts?Configuration?2.0//EN"
        ????????"http://struts.apache.org/dtds/struts-2.0.dtd"
        >
        <struts>
        ????
        <include?file="struts-default.xml"/>
        ????
        <package?name="tutorial"?extends="struts-default">
        ????????
        <action?name="HelloWorld"?class="tutorial.HelloWorld">
        ????????????
        <result>HelloWorld.jsp</result>
        ????????
        </action>
        ????
        </package>
        </struts>

      4. 新建SayHello.jsp

        參考“新建index.html文件”步驟,彈出如圖22所示對(duì)話框
        圖22 新建對(duì)話框
        圖22 新建對(duì)話框
        點(diǎn)擊“Next”, 進(jìn)入下一步,如圖23所示

        圖23 新建JSP對(duì)話框
        圖23 新建JSP對(duì)話框
        在“File name”鍵入SayHello.jsp,點(diǎn)擊“Next”進(jìn)入下一步,如圖24所示

        圖24 模板選擇對(duì)話框
        圖24 模板選擇對(duì)話框
        點(diǎn)擊“Finish”關(guān)閉對(duì)話框,并將SayHello.jsp的內(nèi)容修改為:

        <%@?page?contentType="text/html;?charset=UTF-8"?%>
        <%@?taglib?prefix="s"?uri="/struts-tags"?%>
        <!DOCTYPE?HTML?PUBLIC?"-//W3C//DTD?HTML?4.01?Transitional//EN">
        <html>
        ????
        <head>
        ????????
        <title>Say?Hello</title>
        ????
        </head>
        ????
        <body>
        ????????
        <h3>Say?"Hello"?to:?</h3>
        ????????
        <s:form?action="HelloWorld">
        ????????????Name:?
        <s:textfield?name="name"?/>
        ????????????
        <s:submit?/>
        ????????
        </s:form>
        ????
        </body>
        </html>

      5. 新建HelloWorld.jsp(請(qǐng)參考上一步),HelloWorld.jsp的內(nèi)容為:
        <%@?page?contentType="text/html;?charset=UTF-8"?%>
        <%@?taglib?prefix="s"?uri="/struts-tags"?%>
        <!DOCTYPE?HTML?PUBLIC?"-//W3C//DTD?HTML?4.01?Transitional//EN">
        <html>
        ????
        <head>
        ????????
        <title>Hello</title>
        ????
        </head>
        ????
        <body>
        ????????
        <h3><s:property?value="name"?/></h3>
        ????
        </body>
        </html>

      6. 重新打包發(fā)布應(yīng)用程序

        先停止tomcat, 再將tomcat里webapps下的Struts2_HelloWorld.war和Struts2_HelloWorld文件夾刪除,參照“將應(yīng)用程序打包到tomcat上”重新發(fā)布應(yīng)用程序。

      7. 啟動(dòng)tomcat,運(yùn)行測(cè)試

        打開Internet Explorer,鍵入http://localhost:8080/Struts2_HelloWorld/SayHello.jsp,窗口輸出如圖25所示
        圖25 SayHello.jsp
        圖25 SayHello.jsp
        在“Name”鍵入字符串(如World),點(diǎn)擊Submit,轉(zhuǎn)到HelloWorld.jsp頁(yè)面,如圖26所示

        圖26 HelloWorld.jsp
        圖26 HelloWorld.jsp

    3. 單元測(cè)試Hello World

      在文章開始的時(shí)候提及,單元測(cè)試?yán)щy是Struts一大缺點(diǎn)。現(xiàn)在讓我們?cè)隗w驗(yàn)一下,在Struts 2.0中是如何進(jìn)行測(cè)試的。

      1. 新建JUnit單元測(cè)試

        右鍵點(diǎn)擊Struts2_HelloWorld\Java Resources: src\tutorial,彈出如圖27所示對(duì)話框
        圖27 新建菜單
        圖27 新建菜單
        點(diǎn)擊“Next\Other”

        圖28 新建對(duì)話框
        圖28 新建對(duì)話框
        選擇“Java\JUnit\JUnit Test Case”,點(diǎn)擊“Next”

        圖29 新建JUnit 測(cè)試用例對(duì)話框
        圖29 新建JUnit 測(cè)試用例對(duì)話框
        選擇“New JUnit 4 test”,在“Name”中鍵入HelloWorldTest,在“Class under test”鍵入tutorial.HelloWorld,點(diǎn)擊“Next”

        圖30 選擇方法對(duì)話框
        圖30 選擇方法對(duì)話框
        選中HelloWorld\execute方法,點(diǎn)擊Finish。如果生成的HelloWorldTest.java文件的圖標(biāo)(Icon)出現(xiàn)紅色交叉標(biāo)志,請(qǐng)進(jìn)行以下步驟添加JUnit 4的jar包。

        右鍵點(diǎn)擊Struts2_HelloWorld,出現(xiàn)如圖所示菜單。 圖31 新建菜單
        圖31 新建菜單
        點(diǎn)擊“Build Path\Add Libararis”,彈出圖32對(duì)話框

        圖32 添加庫(kù)對(duì)話框
        圖32 添加庫(kù)對(duì)話框
        選中“JUnit”,點(diǎn)擊“Next”

        圖33 選擇版本對(duì)話框
        圖33 選擇版本對(duì)話框
        選擇“JUnit 4”,點(diǎn)擊“Finish”關(guān)閉對(duì)話框,并將HelloWorldTest.java的內(nèi)容修改為:

        package?tutorial;

        import?static?org.junit.Assert.assertTrue;

        import?org.junit.Test;

        import?com.opensymphony.xwork2.ActionSupport;

        public?class?HelloWorldTest?{

        ????@Test
        ????
        public?void?testExecute()?{
        ????????HelloWorld?hello?
        =?new?HelloWorld();
        ????????hello.setName(
        "World");
        ????????String?result?
        =?hello.execute();
        ????????
        ????????assertTrue(
        "Expected?a?success?result!",?ActionSupport.SUCCESS.equals(result));
        ????????
        ????????
        final?String?msg?=?"Hello,?World!";
        ????????assertTrue(
        "Expected?the?default?message!",?msg.equals(hello.getName()));
        ????}


        }

      2. 運(yùn)行單元測(cè)試

        右鍵點(diǎn)擊Struts2_HelloWorld\Java Resources: src\tutorial\HelloWorldTest.java,彈出如圖34所示菜單
        圖34 運(yùn)行為菜單
        圖34 運(yùn)行為菜單
        點(diǎn)擊“Run As\JUnit Test”,出現(xiàn)JUnit子窗口如圖35所示

        圖35 JUnit子窗口
        圖35 JUnit子窗口
        圖35的綠色矩形表示,所有單元測(cè)試通過。

    4. 總結(jié)

      上面的例子簡(jiǎn)單地演示了,Web 應(yīng)用程序的基本操作,也即是,頁(yè)面輸入->Action處理->再輸出到另外頁(yè)面。Struts 2.0的簡(jiǎn)單易用、方便測(cè)試相信也會(huì)給大家留下不錯(cuò)的印象吧。我相信,Struts 2.0作為一個(gè)全新的Web架構(gòu),將會(huì)再次掀起Web開發(fā)的熱潮。 不過,Struts 2.0還在測(cè)試中,正式版的發(fā)布還需些時(shí)日,所以文檔方面可能有所欠缺。請(qǐng)大家繼續(xù)留意我的博客,我會(huì)盡我所能為大家寫更多關(guān)于Struts 2.0的文章。

    posted on 2006-10-10 18:35 Max 閱讀(126059) 評(píng)論(345)  編輯  收藏 所屬分類: Struts 2.0系列
    評(píng)論共4頁(yè): 上一頁(yè) 1 2 3 4 

    評(píng)論:
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-10 19:18 | stoneshao
    step by step,ok  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-10 20:17 | pear
    呵呵,不錯(cuò)不錯(cuò),請(qǐng)問Struts還有沒有象DispathAction這樣的ActionSupport呢? 多個(gè)方法對(duì)應(yīng)一個(gè)Action..  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-10 21:03 | badqiu1
    struts2為何不學(xué)習(xí)ROR的convention over configuration,
    寫個(gè)helloworld要那么多步驟```

    BTW:
    spring MVC已經(jīng)提供對(duì)convention over configuration的支持``  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-10 22:13 | Max
    @pear
    謝謝你們的留言,Struts 2.0有DispathAction的概念,而且比其更簡(jiǎn)單易用。這點(diǎn)我會(huì)在以后的文章中提及。  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-10 22:21 | Max
    @badqiu1
    首先,要道個(gè)歉,我以前不常寫B(tài)log,所以有點(diǎn)過于繁鎖。
    不過,我只要是想在這篇文章把IDE的使用和Struts的配置說得詳細(xì)一點(diǎn)。
    其實(shí),簡(jiǎn)而言之,要實(shí)現(xiàn)例子中的功能,只需要3個(gè)步驟:
    1、編寫ActionSupport類
    2、配置struts.xml
    3、編寫JSP  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-10 22:32 | gf
    恩,有點(diǎn)象webwork,我去下個(gè)看看  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-10 23:59 | jeffjie
    根本就是Webwork。。  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-11 08:28 | 壞男孩
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-11 09:17 | SWAT
    @jeffjie
    引用Apache Struts官方網(wǎng)上一段話:
    Struts 2 was originally known as WebWork 2. After working independently for several years, the WebWork and Struts communities joined forces to create Struts 2. The new framework is the best choice for teams who value elegant solutions to difficult problems.
    看到這里相信大家對(duì)WebWork和Struts 2.0的關(guān)系已經(jīng)清楚了。  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-11 10:02 | 123bingbing
    增開7群,號(hào)碼 30440732
    8群 30756649
    9群 30178567
    10群 28694497

    我們的qq群:15096318 學(xué)習(xí)程序的都可以來  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-11 12:14 | 捕風(fēng)
    充分體現(xiàn)了struts的xionghuai  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-11 13:25 | 黑蝙蝠
    大哥 我怎么也配置不上lomboz 我下的eclipse是3.2版本 ....  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-11 14:02 | Max
    @黑蝙蝠
    對(duì)不起,恐怕幫不了你。因?yàn)椋业牟皇莑omboz,而是Eclipse的webtools,挺好用的。我建議您可以試一下。用Eclipse的Software Update或到http://www.eclipse.org/webtools/去下載都可以。  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-13 09:37 | niyong
    沒意思,就是webwork2,沒什么新穎的  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-13 14:03 | 1
    如果你是編程高手,這里將是你一個(gè)展現(xiàn)自我的新舞臺(tái)----www.mylinux.com.cn
      回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-23 23:56 | Unmi
    就是webwork啊  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-26 22:57 | esmiles
    糾正一個(gè)錯(cuò)誤:
    HelloWorld.jsp中的<s:property name="name" />
    name屬性是錯(cuò)的。應(yīng)該改成value屬性,既:
    <s:property value="name" />

      回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-27 09:12 | Max
    @esmiles
    Thanks,已經(jīng)改正。  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-27 14:36 | 風(fēng)人園
    請(qǐng)問一個(gè)問題,我按照你的配置,他出現(xiàn)如下錯(cuò)誤,在
    classpath下加了 struts.properties這個(gè)文件還是說沒有找到

    Could not find or error in struts.properties
    java.lang.IllegalStateException: struts.properties missing

    請(qǐng)問有遇到這種問題嗎 ?
      回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-27 14:48 | Max
    @風(fēng)人園
    我沒有遇過這種情況。
    其實(shí)不用加也是可以運(yùn)行的,只不過在tomcat加載應(yīng)用程序時(shí)會(huì)有提示。
    加一個(gè)空白的struts.properties文件就可以解決。
    Struts 2.0有兩個(gè)配置文件,struts.xml和struts.properties都是放在WEB-INF/classes/下。
    1、struts.xml用于應(yīng)用程序相關(guān)的配置
    2、struts.properties用于Struts 2.0的運(yùn)行時(shí)(Runtime)的配置  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-29 17:15 | 張先生
    請(qǐng)問struts-default.xml文件放哪合適?  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-29 22:17 | soddabao
    樓主的Dynamic Web Project插件是什么插件,myeclipse么?  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-30 10:44 | Max
    @張先生
    struts-default.xml文件不用您自己加,它位于struts2-core-2.0.0.jar包中。  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-30 10:45 | Max
    @soddabao
    不是,是Eclipse的webtools的。  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-10-30 14:43 | Liangjava
    還有就是一個(gè),沒有插件.在編輯方面不行,只能調(diào)試才看得出來  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-01 17:42 | 風(fēng)人園
    我按照你的步驟,但是老是提示說下面的資源不可用,這是怎么回事?

    The requested resource (/strutstest/HelloWorld) is not available.

    strutstest是項(xiàng)目名  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-02 09:49 | Max
    @風(fēng)人園
    請(qǐng)問您的服務(wù)器是不是tomcat?  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-02 13:01 | 風(fēng)人園
    是的,用tomcat會(huì)有什么問題嗎?
      回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-02 23:14 | Tin
    謝謝Max的教程。大家也可以到WebWork中文網(wǎng)站:http://webwork.javascud.org/
    http://wiki.javascud.org/display/ww2cndoc/WebWork
    看看。里面有WebWork 2.2的中文參考手冊(cè)。
    Struts 2.0.1目前還完全等于WebWork 2.2.x,所以可以參照WebWork2手冊(cè)學(xué)習(xí)。  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-03 15:15 | 張先生
    我的服務(wù)器是weblogic,在struts.xml配置中,與tomcat大相徑庭,我至現(xiàn)在都未配置好,有誰成果過,指點(diǎn)為盼!謝謝!  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-06 09:43 | 千里皚皚雁飛飛
    1)標(biāo)簽庫(kù):<%@ taglib prefix="s" uri="/struts-tags" %>是否還在web.xml中配置?

    2)我的服務(wù)器是weblogic8.1,是否weblogic8.1能支持struts2?

    要是不支持struts2,我就不打算堅(jiān)持下去了。
      回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-06 13:41 | pear
    @千里皚皚雁飛飛
    1. 記得不用
    2. 不支持weblogic? 呵呵,不大可能,我沒try過,你try一下啦.  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-06 17:08 | Max
    @千里皚皚雁飛飛
    1)不用,Struts 2.0已經(jīng)為您做了
    2)肯定支持,因?yàn)樗械腤EB服務(wù)器,如tomcat、weblogic等都必須遵循Servlet規(guī)范的。  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-07 08:55 | 千里皚皚雁飛飛
    謝謝pear和Max的回復(fù),

    不論是在JBuilder中調(diào)試,還是直接設(shè)置一個(gè)虛擬目錄,用tomcat4.1、

    tomcat5.0,還是weblogic總是報(bào)錯(cuò),其中weblogic報(bào)兩個(gè)JSP文件中

    <%@ taglib prefix="s" uri="/struts-tags" %>引用錯(cuò)誤,

    我盡自己所能做的挽救,還是不行。


    使用tomcat5.5可以在JBuilder 中調(diào)試通過。


    奇怪了,難道Struts2是挑服務(wù)器的???


      回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-07 20:09 | 張先生
    情況屬實(shí),反正我是weblogic9,老是跳轉(zhuǎn)頁(yè)面,找不著路徑?我已改.試了好幾天,均不行!!就是struts.xml中的配置!!!  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-08 08:07 | 千里皚皚雁飛飛
    to 張先生:

    你的weblogic9是哪里down的???能否給一個(gè)連接。

    昨天把程序退到webwork下,試了試,一切正常。


    to Max:

    struts2剛剛推出,網(wǎng)上帖子、介紹不多,希望博主能夠多多介紹一些。


      回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-10 00:47 | Goingmm[匿名]
    簡(jiǎn)單易懂!測(cè)試通過

    需要嘗試的朋友,有一個(gè)細(xì)節(jié)需要注意:
    我開始圖方便是把所有包都引入。結(jié)果出現(xiàn)struts2-all-2.0.1.jar包和struts2-core-2.0.1.jar包沖突。原因很簡(jiǎn)單就是這2個(gè)包里面都有struts-default.xml文件。造成重復(fù)定義
    結(jié)論:在struts-2.0.1的lib下面有很多jar包。做這個(gè)測(cè)試只需要引入圖5顯示的其中6個(gè)包(在版本2.0.1里面沒有struts2-extras-2.0.0.jar,所以不用引這個(gè)包)
      回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-11 09:59 | 千里皚皚雁飛飛
    to Goingmm:
    謝謝,謝謝,一會(huì)兒我再試試!  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-22 21:42 | 太行山人
    default-config.xml有什么用?一定要include到struts.xml中嗎?  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-26 18:32 | Max
    Default-config.xml contains some interceptor stacks and common configurations. Including it can help you to create action easier  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-27 11:33 | breezedancer
    轉(zhuǎn)到www.51forum.uni.cc謝謝  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-27 12:36 | 太行山人
    如果我不想用default-config.xml中的默認(rèn)配置,而是自己對(duì)default-config.xml中的一些參數(shù)自定義,應(yīng)該把這個(gè)文件放在哪里呢?還是直接覆蓋jar包中的這個(gè)文件呢?
    或者,在struts.xml中配置相應(yīng)的元素,會(huì)覆蓋default-config.xml中相應(yīng)元素的配置?  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-11-28 23:52 | Max
    在struts.xml中配置相應(yīng)的元素,可以覆蓋default-config.xml中相應(yīng)元素的配置。  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-12-02 13:26 | jakki
    @Max
    警告: Could not find or error in struts.properties
    java.lang.IllegalStateException: struts.properties missing

    我老是遇到報(bào)這個(gè)錯(cuò),我已經(jīng)加了這個(gè)文件了,怎么還報(bào)  回復(fù)  更多評(píng)論
      
    # re: 為Struts 2.0做好準(zhǔn)備 2006-12-04 18:50 | 張先生
    把struts.properties 放到classes下即可了!!  回復(fù)  更多評(píng)論
      
    評(píng)論共4頁(yè): 上一頁(yè) 1 2 3 4 
    主站蜘蛛池模板: 亚洲色欲www综合网| 69免费视频大片| 精品亚洲福利一区二区| 在线电影你懂的亚洲| 日韩国产欧美亚洲v片| 亚洲男人的天堂网站| 亚洲精品二三区伊人久久| 自怕偷自怕亚洲精品| 美女羞羞视频免费网站| 另类小说亚洲色图| 成人久久久观看免费毛片| 一级毛片免费播放试看60分钟| 黄桃AV无码免费一区二区三区| 国产大片免费天天看| 国产精品免费大片| 一级毛片在线免费观看| 精品免费人成视频app| 永久免费av无码不卡在线观看| 女人被免费视频网站| 精品熟女少妇AV免费观看| 免费永久在线观看黄网站| 亚洲国产综合久久天堂| 亚洲第一页综合图片自拍| 中文字幕中韩乱码亚洲大片| 久久久影院亚洲精品| 亚洲黄色免费网站| 两性色午夜免费视频| 国产又粗又长又硬免费视频 | 亚洲国产精品一区二区第一页免| 亚洲视频在线免费看| 国产午夜精品理论片免费观看| 白白国产永久免费视频| 亚洲夜夜欢A∨一区二区三区| 亚洲一区二区三区自拍公司| 校园亚洲春色另类小说合集| 日韩吃奶摸下AA片免费观看| 99久久精品国产亚洲| 另类专区另类专区亚洲| 18禁无遮挡无码网站免费| 亚洲国产综合自在线另类| 偷自拍亚洲视频在线观看99|