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

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

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

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

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

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

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

            2. 打開(kāi)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)過(guò)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. 打開(kāi)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)用程序

              打開(kāi)你的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è)試

              打開(kāi)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

            在文章開(kāi)始的時(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è)試通過(guò)。

          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開(kāi)發(fā)的熱潮。 不過(guò),Struts 2.0還在測(cè)試中,正式版的發(fā)布還需些時(shí)日,所以文檔方面可能有所欠缺。請(qǐng)大家繼續(xù)留意我的博客,我會(huì)盡我所能為大家寫更多關(guān)于Struts 2.0的文章。

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

          評(píng)論:
          # re: 為Struts 2.0做好準(zhǔn)備 2007-07-20 16:44 | jarwang
          還一點(diǎn),是這樣的.前二次按submit中文絕對(duì)亂碼.但有時(shí)連續(xù)提交三次后,就正常了..非常奇怪...  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-07-24 00:03 | Max
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-07-25 09:48 | Yong
          是不是必須在Tomcat 5.5 上進(jìn)行運(yùn)行  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-07-25 09:51 | Yong
          嚴(yán)重:Error filterStart

          嚴(yán)重:Content[/Struts2_HelloWorld]startup failed due to previous errors

          tomcat 5.0 或5.5下都出現(xiàn)這個(gè)問(wèn)題

          希望能給點(diǎn)解決意見(jiàn)   回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-07-25 10:10 | Yong
          嚴(yán)重: Exception starting filter struts2
          java.lang.NoClassDefFoundError: com/opensymphony/util/ClassLoaderUtil
          at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:241)
          at org.apache.struts2.dispatcher.Dispatcher.<init>(Dispatcher.java:127)
          at org.apache.struts2.dispatcher.FilterDispatcher.createDispatcher(FilterDispatcher.java:379)
          at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:160)
          at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)
          at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)
          at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:78)
          at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3635)
          at org.apache.catalina.core.StandardContext.start(StandardContext.java:4222)
          at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
          at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
          at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
          at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
          at org.apache.catalina.core.StandardService.start(StandardService.java:448)
          at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
          at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
          at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
          2007-7-25 10:03:27 org.apache.catalina.core.StandardContext start
          嚴(yán)重: Error filterStart
          2007-7-25 10:03:27 org.apache.catalina.core.StandardContext start
          嚴(yán)重: Context [/Struts2_HelloWorld1] startup failed due to previous errors

          又試了一次后出現(xiàn)的,Tomcat 為5.5的  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-07-25 23:42 | Max
          @Yong
          少了一些包:xwork-2.0.3.jar,請(qǐng)檢查你的Build Path。  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-01 17:15 | 地帶
          寫的簡(jiǎn)單明了,不過(guò)剛開(kāi)始看有點(diǎn)吃力,你寫的只是他的創(chuàng)建過(guò)程,具體的流程原理何不也來(lái)個(gè)簡(jiǎn)單的介紹呢?
          支持你!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-02 18:55 | 陳利
          您好,我照著示例做了,別的一切正常,就是打好war包后,啟動(dòng)tomcat服務(wù)器的時(shí)候,有警告信息:Could not parse struts.local setting,我上網(wǎng)上搜索了一下,也找不到解決的辦法。您能看一下嗎?  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-04 01:33 | jueqinguzhu
          請(qǐng)問(wèn) 我按照上面的做了
          卻是這:
          java.lang.NoClassDefFoundError: com/opensymphony/util/ClassLoaderUtil
          at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:241)
          at org.apache.struts2.dispatcher.Dispatcher.<init>(Dispatcher.java:127)
          at org.apache.struts2.dispatcher.FilterDispatcher.createDispatcher(FilterDispatcher.java:379)
          at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:160)
          at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
          at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
          at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
          at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)
          at org.apache.catalina.core.StandardContext.start(StandardContext.java:4340)
          at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
          at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
          at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
          at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
          at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
          at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
          at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1206)
          at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
          at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
          at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
          at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
          at java.lang.Thread.run(Thread.java:619)
          2007-8-4 1:27:03 org.apache.catalina.core.StandardContext start
          嚴(yán)重: Error filterStart
          2007-8-4 1:27:03 org.apache.catalina.core.StandardContext start
          嚴(yán)重: Context [/struts2] startup failed due to previous errors
          這是什么原因啊  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-04 01:41 | jueqinguzhu
          我把2.0.0下的包全部導(dǎo)進(jìn)去才沒(méi)有錯(cuò)誤
          為什么和你們說(shuō)的不一樣呢
            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-08 10:50 | 愛(ài)好者
          我才開(kāi)始學(xué)習(xí)STRUTS2,測(cè)試了以上的案例有一些基礎(chǔ)的體會(huì)!謝謝!不知道有沒(méi)有更多的相關(guān)的中文資料可以提供哦!或提供網(wǎng)址下載!
          我也會(huì)在這里一節(jié)一節(jié)的學(xué)習(xí)下去,學(xué)習(xí)更多的知識(shí),謝謝了哈!!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-09 14:01 | 5006benben
          @maomao
          你的版本有問(wèn)題~~!!
          你用的是tomcat5.0的話,struts.xml和web.xml里的文件格式是一致的,要是不一致就會(huì)出錯(cuò)!!
          我就犯了那個(gè)錯(cuò)誤,弄了半天!
          你下一個(gè)tomcat5.5改一下就行了!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-09 17:12 | bbo
          jar引用多了  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-10 00:19 | 初學(xué)
          /testresin3/HelloWorld was not found on this server.   回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-13 10:27 | 風(fēng)雲(yún)の軌跡
          在頁(yè)面的<head>標(biāo)簽中加入<s:head /> 就可以了
          ...
          <head>
          <title>Struts 2 Cool Tags - Others</title>
          <s:head />
              ...
          </head>
          ...
          具體我也不是很了解,我也是在網(wǎng)上搜到的這個(gè)解決方法,但是很有用,在這個(gè)Bolg上也有相關(guān)的文章:
          http://www.aygfsteel.com/max/archive/2007/06/12/123682.html
          這個(gè)Bolg寫的非常好,我覺(jué)得里面有許多我初學(xué)時(shí)所遇到疑惑的解決方法!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-13 14:57 | totti
          我也是復(fù)制 struts.xml文件名稱有錯(cuò)誤。。。
          找了半天原因,復(fù)制惹的禍呀。。。  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-16 13:41 |
          寫的很實(shí)用 支持 繼續(xù)關(guān)注!!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-08-17 09:34 | cc
          第一次看 對(duì)著配置 我啟動(dòng)后說(shuō)找不到struts.properties
          我后來(lái)自己加上去 就好了
          還有就是我下載的struts2.0.6里面的包和2.0.0不一樣呀
          沒(méi)辦法下載的2.0.0才配置的
          東西好,謝謝
          qq:281663415  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-08-17 11:03 | cc
          HelloWord.jsp
          打印數(shù)據(jù)加一段,改成:
          <h3><s:property value="name" /></h3>
          <%
          out.print( request.getAttribute("name") );
          %>
          會(huì)發(fā)現(xiàn)第一次提交SayyHellow.jsp
          打印出來(lái)是的:Hello, 32!
          null,
          然后不關(guān)閉瀏覽器后退,在執(zhí)行提交表單
          打印出來(lái)的就是:Hello, 32!
          Hello, 32!
          而且 就只有第一次是這樣,后面就不會(huì)是null了  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-18 18:20 | Elven
          Max,你好!
          我剛開(kāi)始學(xué)習(xí)使用Struts2.0,很多地方不明白,還望賜教!
          我一步一步按照你的方法去做的(除了Struts用的是2.0.9版本),但是我在做一個(gè)簡(jiǎn)單的還沒(méi)有用到Struts2.0的HelloWorld的web應(yīng)用時(shí),我的tomcat就提示我HTTP Status 404 -錯(cuò)誤,請(qǐng)問(wèn)這是怎么回事?  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-20 14:16 | Elven
          max,你好!
          我按照你的方法那樣做了,但是怎么要提示HTTP Status 404找不到源的錯(cuò)誤。
          不管是打包到Tomcat下,還是用tomcat虛擬目錄建立web應(yīng)用,都會(huì)提示這樣的錯(cuò)誤。
          你能幫我想一想,究竟在哪一步出錯(cuò)了嗎?
          我真的太想把Struts2學(xué)會(huì)了,你能幫幫我嗎?
          萬(wàn)分感謝!!!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-22 15:09 |
          hao好人哪  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-22 15:23 | mybygao
          Tomcat要5.5版的。
          apache網(wǎng)站上有例子。  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-08-22 17:37 | Mike
          檢查了一下,沒(méi)有復(fù)制錯(cuò)誤,也沒(méi)有代碼錯(cuò)誤。但是調(diào)用helloworld時(shí)報(bào)404
          description The requested resource (/Struts2/HelloWorld) is not available.

          struts.xml:
          <!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>
          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.jsp</welcome-file>
          </welcome-file-list>
          </web-app>  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-22 18:01 | Elven
          max這段時(shí)間去哪了?
          怎么都不理我們這些Struts2.0的初學(xué)者了?  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-22 22:46 | Max
          @Elven
          @Mike
          對(duì)不起,這段時(shí)間比較忙,所以沒(méi)有來(lái)得及回來(lái)大家的評(píng)論。
          因?yàn)閷戇@篇文章的時(shí)候,我的寫作經(jīng)驗(yàn)還比較淺,所以有些地方不太明白。過(guò)兩天有時(shí)間,我會(huì)重新寫這篇文章的。
          請(qǐng)大家稍等。  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-08-22 22:52 | Elven
          謝謝你,max!期待你寫出更有水平,更全面的文章!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-08-23 11:18 | Mike
          問(wèn)題原因找到了,因?yàn)閟ayhello.jsp的<s:form action="HelloWorld">我加了一個(gè)“/”<s:form action="/HelloWorld">,所以容器說(shuō)找不到,爺爺?shù)模俏疫€是想知道為什么它找不到,max能解釋一下么,謝謝  回復(fù)  更多評(píng)論
            
          #  為Struts 2.0做好準(zhǔn)備 2007-08-24 21:46 | yuxiang
          請(qǐng)問(wèn)我
          圖25 SayHello.jsp
          當(dāng)我提交時(shí),報(bào)以下錯(cuò)誤

          type Status report

          message /TestStruts2/HelloWorld

          description The requested resource (/TestStruts2/HelloWorld) is not available.

          按理來(lái)說(shuō).他報(bào)的錯(cuò)誤在我們一般的情況下是正確的
          但是我們用的struts 里面有配置action=HelloWorld
          就跳轉(zhuǎn)到/HelloWorld.jsp頁(yè)面的啊???
          還請(qǐng)幫忙!
          有問(wèn)題得不到解決真是很煩.
            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-08-25 11:03 | fish
          添加Junit的classlibrary時(shí),選擇Junit4時(shí),顯示JUnit 4 requires a Java 5 project
          什么問(wèn)題呀  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-08-31 10:45 | jean
          求助小弟我遇到一個(gè)問(wèn)題困擾好久
          發(fā)生再重複deploy因?yàn)閟truts2-core-2.0.9.jar(再使用中無(wú)法刪除)
          我用Tomcat5 跟 sun Applicion server8.2都一樣
          該如何是好請(qǐng)幫幫忙謝謝???

            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-09-04 17:15 | cg
          少一個(gè)包:oscore-2.2.4.jar  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-09-04 22:17 | idodolook2007
          警告: Could not find or error in struts.properties
          java.lang.IllegalStateException: struts.properties missing
          at org.apache.struts2.config.PropertiesSettings.<init>(PropertiesSettings.java:49)
          at org.apache.struts2.config.DefaultSettings.<init>(DefaultSettings.java:52)
          at org.apache.struts2.config.Settings.getDefaultInstance(Settings.java:202)
          at org.apache.struts2.config.Settings.getInstance(Settings.java:76)
          at org.apache.struts2.config.Settings.get(Settings.java:134)
          at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:179)
          at org.apache.struts2.dispatcher.Dispatcher.<init>(Dispatcher.java:143)
          at org.apache.struts2.dispatcher.FilterDispatcher.createDispatcher(FilterDispatcher.java:397)
          at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:163)
          at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:223)
          at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:304)
          at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:77)
          at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3600)
          at org.apache.catalina.core.StandardContext.start(StandardContext.java:4193)
          at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
          at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
          at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
          at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809)
          at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698)
          at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
          at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
          at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
          at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
          at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
          at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
          at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
          at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
          at org.apache.catalina.core.StandardService.start(StandardService.java:450)
          at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
          at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
          at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
          你好,我已經(jīng)在src下添加了struts.properties文件,卻還是報(bào)錯(cuò),因此想問(wèn)問(wèn)是什么原因引起的?謝謝  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-09-05 16:18 | jean
          @cg

          你是說(shuō)我要把oscore-2.2.4.jar放到lib裡嗎??
          我有放進(jìn)去了可是重新deploy
          struts2-core-2.0.9.jar還是被lock
          oscore-2.2.4.jar的作用為何可否說(shuō)明一下
          謝謝  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-09-05 17:51 | 無(wú)為
          為什么web.xml里<?xml version="1.0" encoding="ISO-8859-1"?>的字符集是"ISO-8859-1"而其它文件里用的是"UTF-8"呀?有什么區(qū)別呀.還有為什么在JSP頁(yè)面里用"ISO-8859-1"就不能保存,用"UTF-8"就可以呀?  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-09-10 10:45 | calm feeling
          2.09
          錯(cuò)誤404,悶啊!!大哥救命啊!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-09-10 15:14 | calm feeling
          問(wèn)題解決,哈哈  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-09-11 16:39 | 小牛
          @就
          org.apache.jasper.JasperException
          org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
          org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
          org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:234)


          root cause

          java.lang.NullPointerException
          org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:701)
          org.apache.struts2.components.UIBean.end(UIBean.java:448)
          org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:35)
          org.apache.jsp.SayHello_jsp._jspx_meth_s_textfield_0(SayHello_jsp.java:138)
          org.apache.jsp.SayHello_jsp._jspx_meth_s_form_0(SayHello_jsp.java:107)
          org.apache.jsp.SayHello_jsp._jspService(SayHello_jsp.java:71)
          org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
          org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
          org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:234)


          note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.

          在輸入SayHello.jsp頁(yè)面時(shí)出現(xiàn)這個(gè)錯(cuò)誤!
            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-09-12 20:49 | Elven
          @calm feeling
          你的404錯(cuò)誤是怎么解決的啊?
          我的也一直提示404錯(cuò)誤。
          我懷疑是web.xml出了問(wèn)題,但是又不知道怎么改?
          求助解決辦法。  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-09-13 09:42 | ttl_web (ttl_web@yahoo.com.cn)
          謝謝!

          通過(guò)您的這篇文章,使我對(duì)struts2 doc中“http://struts.apache.org/2.x/docs/hello-world.html”有了實(shí)際的認(rèn)識(shí)

          再次感謝!!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-09-13 23:14 | xun
          請(qǐng)問(wèn)下面的問(wèn)題怎么解決??

          嚴(yán)重: Exception starting filter struts2
          Error loading configuration file struts-default.xml - Class: com.opensymphony.xwork2.config.providers.XmlConfigurationProvider
          File: XmlConfigurationProvider.java
          Method: loadConfigurationFiles
          Line: 850 - com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java:850:-1
          at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:135)
          at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:100)
          at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:130)
          at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
          at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
          at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
          at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)
          at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
          at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
          at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
          at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3693)
          at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
          at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
          at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
          at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
          at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
          at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
          at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
          at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
          at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
          at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
          at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)
          at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
          at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
          at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
          at org.apache.catalina.core.StandardService.start(StandardService.java:448)
          at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
          at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:582)
          at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
          at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
          Caused by: java.lang.NullPointerException
          at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:850)
          at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:131)
          ... 33 more
          2007-9-13 23:06:10 org.apache.catalina.core.StandardContext start
          嚴(yán)重: Error filterStart
          2007-9-13 23:06:10 org.apache.catalina.core.StandardContext start
          嚴(yán)重: Context [/Struts2_HelloWorld] startup failed due to previous errors
          2007-9-13 23:06:11 org.apache.coyote.http11.Http11Protocol start  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-09-16 09:21 | Jimmy
          請(qǐng)問(wèn)是不是要tomcat5.5以上的啊?

          我的tomcat5.0.16+jdk1.42+struts2.10老是報(bào)錯(cuò)

          Status report

          message /Struts2_HelloWorld/

          description The requested resource (/Struts2_HelloWorld/) is not available.

            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-09-18 15:29 | @ctan
          郁悶,我的報(bào)這個(gè)錯(cuò) \
          myeclipse5.0 tomcat5.0 jdk1.4.2

          信息: validateJarFile(C:\java_dev\Tomcat 5.0\webapps\Struts2App\WEB-INF\lib\servlet-api-2.4.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
          2007-9-18 15:19:25 org.apache.catalina.core.StandardContext start
          嚴(yán)重: Error filterStart
          2007-9-18 15:19:25 org.apache.catalina.core.StandardContext start
          嚴(yán)重: Context startup failed due to previous errors
          2007-9-18 15:19:25 org.apache.catalina.core.StandardHostDeployer install
          信息: Installing web application at context path /tomcat-docs from URL file:C:\java_dev\Tomcat 5.0\webapps\tomcat-docs

          謝謝各位老大。  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-09-20 11:14 | 臺(tái)風(fēng)過(guò)境
          嚴(yán)重: Exception starting filter struts2
          Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean - jar:file:/F:/JavaProjects/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/webapps/Struts2_HelloWorld/WEB-INF/lib/struts2-spring-plugin-2.0.9.jar!/struts-plugin.xml:8:132
          ……
          Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware
          ……
          嚴(yán)重: Error filterStart
          2007-9-20 11:01:46 org.apache.catalina.core.StandardContext start
          嚴(yán)重: Context [/Struts2_HelloWorld] startup failed due to previous errors
          2007-9-20 11:01:51 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
          信息: Parsing configuration file [struts-default.xml]
          2007-9-20 11:01:53 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
          信息: Parsing configuration file [struts-plugin.xml]
          2007-9-20 11:01:53 org.apache.catalina.core.StandardContext filterStart
          嚴(yán)重: Exception starting filter struts2
          按照Max說(shuō)的方法還是不能解決奧,前面出現(xiàn)這個(gè)問(wèn)題的朋友不知道怎么解決的?  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-09-20 15:32 | 臺(tái)風(fēng)過(guò)境
          Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory
          這個(gè)tomcat啟動(dòng)錯(cuò)誤已經(jīng)解決,樓主的例子順利通過(guò)了,嘿嘿!

          我之前是把struts-2.0.9-lib中的所有jar包都放到WEB-INF/lib中,才出現(xiàn)上面那個(gè)錯(cuò)誤,后來(lái)把lib中的包刪除,只保留
          ? struts2-core.jar
          ? xwork.jar
          ? ognl.jar
          ? freemarker.jar
          ? commons-logging.jar
          就順利通過(guò)了,看來(lái)把所有的包都導(dǎo)入,未必是件可取的事情啊!
            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-09-20 16:31 | 臺(tái)風(fēng)過(guò)境
          打好war包后,啟動(dòng)tomcat服務(wù)器的時(shí)候,有警告信息:Could not parse struts.local setting,substituting default VM local,不知道怎么回事,我在eclipse下啟動(dòng)tomcat運(yùn)行是沒(méi)問(wèn)題的!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-09-21 13:26 | Jimmy
          javax.servlet.ServletException: Filter execution threw an exception


          root cause

          java.lang.Error: Unresolved compilation problem:
          The public type HelloWorld must be defined in its own file

          tutorial.HelloWorld.<init>(Helloworld.java:5)

            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-09-26 08:21 | 小燕子
          請(qǐng)問(wèn)一下老師,我的eclipse3.2中裝了myeclipse5.1.1為什么沒(méi)有創(chuàng)建dynamic web project工程的地方呢  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-09-26 14:42 | 小學(xué)生
          老師您好:
          我照著這個(gè)樣子做了一下,現(xiàn)在已經(jīng)能運(yùn)行起來(lái)了,但是,就是在eclipse中總是報(bào)這個(gè)錯(cuò):
          The value [HelloWorld] for attribute [action] in tag [form] is not valid.
          報(bào)錯(cuò)的位置是SayHello.jsp中的第9行:<s:form action="HelloWorld">,請(qǐng)問(wèn),這是什么原因呢?

          另外,您說(shuō)的“
          按ctr +a全選,復(fù)制,再轉(zhuǎn)到Eclipse窗口,在“Project Explorer”子窗口中選中Struts2_HelloWorld\WebContent\WEB-INF\lib,然后粘貼。

          的這一句話,我實(shí)在不知道如何操作,因?yàn)椋?dāng)我在“Project Explorer”子窗口中選中Struts2_HelloWorld\WebContent\WEB-INF\lib的時(shí)候,paste選擇項(xiàng)是灰色的,因此,我只好將這些jar文件直接文件拷貝到了lib目錄下,但是,就是在project explorer中的Struts2_HelloWorld\Java Resources: src\Libraries\Web App Libraries下看不到這些jar文件。盡管如此,卻又不影響打包和運(yùn)行;)

          我現(xiàn)在確實(shí)不知道我在哪里出錯(cuò)了,希望老師同學(xué)指點(diǎn)一下,謝謝!!!

            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-09-26 15:01 | 小學(xué)生
          老師您好:
          現(xiàn)在直接文件拷貝到了lib目錄下的jar文件能在project explorer中的Struts2_HelloWorld\Java Resources: src\Libraries\Web App Libraries下看到了!!!不好意思,剛才耐心不夠~~ :P

          但是,SayHello.jsp中的第9行:<s:form action="HelloWorld">,依然會(huì)引起eclipse報(bào):The value [HelloWorld] for attribute [action] in tag [form] is not valid.的錯(cuò)誤。答案期待中......



            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-09-27 16:57 | T
          有沒(méi)有誰(shuí)搞好了的,提供給我一個(gè)讓我看看,我搞的老是出錯(cuò)。
          如方便發(fā)到郵箱里22211369(at)qq.com  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-10-09 11:16 | 88
          嚴(yán)重: Exception starting filter struts2
          Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean - jar:file:/D:/mytools/apache-tomcat-5.5.23/webapps/Struts2_HelloWorld/WEB-INF/lib/struts2-spring-plugin-2.0.9.jar!/struts-plugin.xml:8:132
          嚴(yán)重: Error filterStart
          2007-10-9 10:59:28 org.apache.catalina.core.StandardContext start
          嚴(yán)重: Context [/Struts2_HelloWorld] startup failed due to previous errors
          2007-10-9 10:59:29 org.apache.coyote.http11.Http11BaseProtocol start
          信息: Starting Coyote HTTP/1.1 on http-8080
          2007-10-9 10:59:29 org.apache.jk.common.ChannelSocket init
          信息: JK: ajp13 listening on /0.0.0.0:8009
          2007-10-9 10:59:30 org.apache.jk.server.JkMain start
          信息: Jk running ID=0 time=0/141 config=null
          2007-10-9 10:59:30 org.apache.catalina.storeconfig.StoreLoader load
          信息: Find registry server-registry.xml at classpath resource
          2007-10-9 10:59:30 org.apache.catalina.startup.Catalina start
          信息: Server startup in 41750 ms  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-10-11 16:25 | 金立軍
          請(qǐng)教一下我在調(diào)式這第段代碼:
          <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
          <%@ taglib prefix="s" uri="/struts-tags" %>

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <html xmlns="http://www.w3.org/1999/xhtml">
          <head>
          <title>Struts 2 Cool Tags - &lt;s:doubeselect/ &gt;</title>
          <s:head />
          </head>
          <body>
          <h2>&lt;s:doubleselect/&gt;</h2>
          <s:form action="Store" >
          <s:set name="foobar"
          value="#{'Java': {'Spring', 'Hibernate', 'Struts 2'}, '.Net': {'Linq', ' ASP.NET 2.0'}, 'Database': {'Oracle', 'SQL Server', 'DB2', 'MySQL'}}" />
          <s:doubleselect list="#foobar.keySet()"
          doubleName="technology"
          doubleList="#foobar[top]"
          label="Technology" />
          </s:form>
          </body>
          </html>



          一運(yùn)行就出現(xiàn)這下面這個(gè)錯(cuò)誤:


          FreeMarker template error!

          Expression parameters.formName is undefined on line 76, column 43 in template/simple/doubleselect.ftl.
          The problematic instruction:
          ----------
          ==> ${parameters.formName} [on line 76, column 41 in template/simple/doubleselect.ftl]
          in include "/${parameters.templateDir}/simple/doubleselect.ftl" [on line 3, column 1 in template/xhtml/doubleselect.ftl]
          ----------

          Java backtrace for programmers:
          ----------
          freemarker.core.InvalidReferenceException: Expression parameters.formName is undefined on line 76, column 43 in template/simple/doubleselect.ftl.
          at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
          at freemarker.core.Expression.getStringValue(Expression.java:118)
          at freemarker.core.Expression.getStringValue(Expression.java:93)
          at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
          at freemarker.core.Environment.visit(Environment.java:196)
          at freemarker.core.MixedContent.accept(MixedContent.java:92)
          at freemarker.core.Environment.visit(Environment.java:196)
          at freemarker.core.Environment.include(Environment.java:1375)
          at freemarker.core.Include.accept(Include.java:155)
          at freemarker.core.Environment.visit(Environment.java:196)
          at freemarker.core.MixedContent.accept(MixedContent.java:92)
          at freemarker.core.Environment.visit(Environment.java:196)
          at freemarker.core.Environment.process(Environment.java:176)
          at freemarker.template.Template.process(Template.java:232)
          at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:148)
          at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:530)
          at org.apache.struts2.components.UIBean.end(UIBean.java:484)
          at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:43)
          at org.apache.jsp.index_jsp._jspx_meth_s_doubleselect_0(index_jsp.java:185)
          at org.apache.jsp.index_jsp._jspx_meth_s_form_0(index_jsp.java:133)
          at org.apache.jsp.index_jsp._jspService(index_jsp.java:76)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
          at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
          at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
          at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
          at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
          at java.lang.Thread.run(Thread.java:595)
          請(qǐng)問(wèn)一下各位是什么原因呀
          學(xué)生在此謝過(guò)了
            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-10-19 15:07 | zero
          java.lang.NoSuchMethodError: javax.xml.transform.dom.DOMResult.getNextSibling()Lorg/w3c/dom/Node;
          at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getOutputHandler(TransformerImpl.java:390)
          at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerHandlerImpl.setResult(TransformerHandlerImpl.java:137)
          at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.setup(DomHelper.java:213)
          at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:198)
          at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:189)
          at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:175)
          at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)
          at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:830)
          at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:131)
          at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:100)
          at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:130)
          at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
          at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
          at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
          at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)
          at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:225)
          at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:308)
          at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:79)
          at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3676)
          at org.apache.catalina.core.StandardContext.start(StandardContext.java:4327)
          at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
          at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
          at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
          at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
          at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
          at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:683)
          at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
          at org.apache.catalina.startup.HostConfig.start(HostConfig.java:964)
          at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
          at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
          at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
          at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
          at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
          at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
          at org.apache.catalina.core.StandardService.start(StandardService.java:476)
          at org.apache.catalina.core.StandardServer.start(StandardServer.java:2298)
          at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
          at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)

          我在測(cè)試上面的例子的時(shí)候,發(fā)生了上面的錯(cuò)誤  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-10-19 15:50 | zero
          是jdk版本的原因,如果使用jdk1.4會(huì)報(bào)錯(cuò)但是使用jdk1.6就會(huì)報(bào)上面的這個(gè)錯(cuò)誤,使用jdk1.5就正常了。  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-10-24 12:44 | 信鴿
          學(xué)到了  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-10-31 09:46 | heiyechouke
          nice, thanks very much!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2007-10-31 13:55 | 菜鳥(niǎo)
          我的eclipse中為什么不能創(chuàng)建dynamic web project呢?

            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-11-03 15:32 | 帥哥
          只想說(shuō)一個(gè)字,“日”!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-11-08 10:34 | 猛男
          謝謝您給我介紹這么漂亮的“妞子”,用起來(lái)真爽!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-11-11 08:40 | skycliff
          樓主幸苦了,期待更多更好的文章。  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-11-16 11:45 | maszxy
          @就
          好象不對(duì)呀,中文還是顯示亂碼

          我的QQ:531877631  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-11-16 12:14 | maszxy
          @Mike
          因?yàn)槟阍趕truts.xml里給這個(gè)action定的名字是HelloWorld  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-11-16 12:23 | cricy
          都要發(fā)布才能測(cè)試嗎?有沒(méi)有可以直接測(cè)試的?  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-11-16 16:43 | onlykwx
          寫得很好,支持一下!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-11-23 11:36 | gongbing
          請(qǐng)問(wèn),您最后發(fā)布應(yīng)用程序的時(shí)候采用的是打包成war文件到tomcat里,但是如果這樣的話,好像每修改一次程序就要把先前的war文件刪除掉,重新打包,這樣做衛(wèi)冕太麻煩了,請(qǐng)問(wèn)有沒(méi)有其他的簡(jiǎn)單一點(diǎn)的辦法?謝謝  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-11-24 17:09 | sandbox
          郁悶,怎么調(diào)都調(diào)試不通 ,提交表單后就是404錯(cuò)誤,也不知道什么原因 望賜教

          另外 感覺(jué)的文章很好,能否告訴一下出處
          email:flywyvern@126.com 同時(shí)希望發(fā)一份這篇文章的測(cè)試源碼,不用帶包,我就不信調(diào)不通
          最后 謝謝:)  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-11-28 16:36 | xiao
          第一個(gè)Struts 2.0應(yīng)用程序——Hello World
          運(yùn)行沒(méi)問(wèn)題

          當(dāng)我在瀏覽器中
          鍵入http://localhost:8080/Struts2_HelloWorld/SayHello.jsp
          后臺(tái)報(bào)異常:
          org.xml.sax.SAXParseException: Element type "bean" must be declared.

          不知是什么原因

          我都弄了一下午都沒(méi)解決問(wèn)題

          麻煩各位了


            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-11-30 13:52 | 不能說(shuō)
          是不是Tomcat5.0不能跑Struts2.0啊???  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-12-08 18:25 |
          非常好!~  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-12-08 18:26 |
          # re: 為Struts 2.0做好準(zhǔn)備 2007-12-08 18:27 |
          @月
          ddd  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-12-18 14:16 | windylovesandy
          我的出錯(cuò),以下錯(cuò)誤是怎么回事?
          我不知道struts-tags.jar在哪來(lái)?我在lib中沒(méi)有找到,應(yīng)該放在哪里。希望指教以下
          HTTP Status 500 -

          type Exception report

          message

          description The server encountered an internal error () that prevented it from fulfilling this request.

          exception

          org.apache.jasper.JasperException: File "/struts-tags" not found
          org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
          org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
          org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:114)
          org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:159)
          org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:423)
          org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)
          org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552)
          org.apache.jasper.compiler.Parser.parse(Parser.java:126)
          org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
          org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
          org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:146)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
          org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
          org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
          org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
          org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

          note The full stack trace of the root cause is available in the Apache Tomcat/5.5.12 logs.  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-12-20 11:40 | 阿祥
          比較好!講得比較細(xì)!thanks (the team)  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-12-20 17:19 |
          有問(wèn)題說(shuō)出來(lái)  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-12-29 00:38 | 凌晨風(fēng)
          2007-12-29 0:24:48 org.apache.struts2.components.Form evaluateExtraParamsServletRequest
          警告: No configuration found for the specified action: 'login.action' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
          2007-12-29 0:24:48 org.apache.struts2.components.Form evaluateExtraParamsServletRequest
          警告: No configuration found for the specified action: 'login.action' in namespace: ''. Form action defaulting to 'action' attribute's literal value.

          出現(xiàn)如下錯(cuò)誤,程序運(yùn)行正常!不知道只是怎么回事?
          錯(cuò)誤發(fā)生在login.jsp頁(yè)面刷新時(shí)就出現(xiàn)。  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2007-12-30 16:28 | xx
          做個(gè)視頻多方便,這樣一張一張的截圖很麻煩  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2008-01-01 18:12 | aa
          @新手
          寫action的名字  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-01-07 17:20 | C++
          警告: No configuration found for the specified action: 'HelloWorld' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
          2008-1-7 16:11:44 org.apache.struts2.components.Form evaluateExtraParamsServletRequest
          警告: No configuration found for the specified action: 'HelloWorld' in namespace: ''. Form action defaulting to 'action' attribute's literal value.


          我都弄了2個(gè)星期了,暈死了!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-01-08 15:34 | 自由化xl
          挺不錯(cuò)的, 謝謝樓主的細(xì)心總結(jié)!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-01-11 23:16 | bizairshop
          很好的例子
          北京機(jī)票推薦 http://www.newskyair.com  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-01-18 14:12 | tt
          @C++
          表單提交的 action name 和 struts.xml 的 action name 是否相同  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-01-20 14:04 | 陳龍
          是個(gè)好文章  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-01-23 16:27 | 漂泊
          警告: No configuration found for the specified action: 'HelloWorld' in namespace
          : ''. Form action defaulting to 'action' attribute's literal value.
          2008-1-23 16:21:56 org.apache.struts2.components.Form evaluateExtraParamsServlet
          Request
          警告: No configuration found for the specified action: 'HelloWorld' in namespace
          : ''. Form action defaulting to 'action' attribute's literal value.

          什麼原因?

            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-01-23 17:04 | C++
          @tt
          我的代碼全是照著復(fù)制、粘貼的,不會(huì)有錯(cuò),我也反復(fù)檢查過(guò)N!遍。郁悶。謝謝tt大俠了  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-01-24 17:16 |
          junit.framework.AssertionFailedError: /WEB-INF/web.xmlが見(jiàn)つかりません
          at servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:344)
          at servletunit.struts.MockStrutsTestCase.tearDown(MockStrutsTestCase.java:130)
          at junit.framework.TestCase.runBare(TestCase.java:130)
          at junit.framework.TestResult$1.protect(TestResult.java:106)
          at junit.framework.TestResult.runProtected(TestResult.java:124)
          at junit.framework.TestResult.run(TestResult.java:109)
          at junit.framework.TestCase.run(TestCase.java:118)
          at junit.framework.TestSuite.runTest(TestSuite.java:208)
          at junit.framework.TestSuite.run(TestSuite.java:203)
          at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
          at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

          我用MockStrutsTestCase框架做的一個(gè)簡(jiǎn)單測(cè)試,哪位老兄幫忙看看是什么問(wèn)題啊?

            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-01-27 13:38 | jinruihua
          @zero
          可能是你的.jsp頁(yè)面的action名與struts中的action不一致導(dǎo)致。
          maybe help.  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-01-28 16:38 |
          是一致的,被測(cè)試的代碼都是成品了,應(yīng)該不是代碼的問(wèn)題  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-02-17 18:46 | 111
          @jarwang
          那是因?yàn)槟愕谋韱蔚木幋a還是ISO8859-1。  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-02-21 14:23 | laibin
          謝謝!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-02-22 09:12 | GG_wg
          例子不錯(cuò),我測(cè)試中文提交也沒(méi)有問(wèn)題(firefox)  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2008-02-22 17:10 | lee
          提交表單后顯示下如錯(cuò)誤:
          警告: No configuration found for the specified action: 'HelloWorld' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
          2008-2-22 17:08:55 org.apache.struts2.components.Form evaluateExtraParamsServletRequest  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-03-10 11:35 | yuan29346
          多謝!
          我是在JBuider上工作的,按照你的提示,呵呵,順利搞定到JB中了。
          現(xiàn)在剛準(zhǔn)備學(xué)這個(gè)struts2,現(xiàn)在有很多疑問(wèn)啊!很郁悶,我們公司不用這個(gè)。
          比如:
          <s:form action="Login">
          <s:text name="username"/><s:textfield key="username"/>
          <s:text name="password"/><s:password key="password" />
          <s:submit/>
          </s:form>
          這個(gè)會(huì)自動(dòng)輸出table,和我想要的不一樣!我相知道怎么樣才能控制輸出的HTML標(biāo)簽?
            回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-03-13 16:45 | zhengtu
          太牛了;
          照做了;
          沒(méi)問(wèn)題;
          講的很細(xì);
          謝謝.  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-03-18 09:20 | 小魏
          照做的,完全正確,在這個(gè)過(guò)程中遇到許多問(wèn)題,解決之后發(fā)現(xiàn)自己學(xué)習(xí)到很多:)
          謝謝:)  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-03-18 12:33 | 木風(fēng)口子
          我第一次運(yùn)行HelloWorld沒(méi)有問(wèn)題,但后來(lái)又不行了,一直報(bào)錯(cuò):
          HTTP Status 404 - /projects/struts/Struts2_HelloWorld

          --------------------------------------------------------------------------------

          type Status report

          message /projects/struts/Struts2_HelloWorld

          description The requested resource (/projects/struts/Struts2_HelloWorld) is not available.

          導(dǎo)出的WAR文件在ROOT/projects/struts/下
          本機(jī)配置:
          jdk1.5,
          eclipse為最新europe
          tomcat5.0.30
          沒(méi)有加載包,因?yàn)槲乙呀?jīng)有l(wèi)omboz struts包
          不會(huì)是沒(méi)加包的原因,
          請(qǐng)賜教!多謝!  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-03-25 17:21 | visitor
          @凌晨風(fēng)
          也困繞我半天。。。
          后來(lái)照另外的教程做出一個(gè)可以跑的,再Beyond compare比較一下,發(fā)現(xiàn)是建立struts.xml時(shí)錯(cuò)了,名字不對(duì),浪費(fèi)好幾個(gè)小時(shí)  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備[未登錄](méi) 2008-03-25 22:37 | 綠茶
          你好..謝謝..我覺(jué)得就是tomcat最好是5.x或6.X..JDK1.5以上吧..我剛開(kāi)始也是按你說(shuō)的那樣去測(cè)試..在以前的版本上測(cè)試..都不行..后來(lái)下了個(gè)新版..就可以了..還是就是...struts.xml一定要放在classess目錄下...  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-03-28 20:01 | pakinsen
          我按照你的方法做了,第一部分是成功的,但是第二步添加了那幾個(gè)JSP文件后,一打開(kāi)TOMCAT就說(shuō)找不到SayHello.jsp。這是為什么呢?我反復(fù)看了你的文章,沒(méi)有地方不一致啊。  回復(fù)  更多評(píng)論
            
          # re: 為Struts 2.0做好準(zhǔn)備 2008-04-07 10:39 | 小新手
          我用的是myeclipse5.0 tomcat5.5 struts2.0.11.1的包,按照上面的步驟連第一部分都不能正常運(yùn)行,如果不按照上面步驟修改web.xml內(nèi)容的話第一步反而能實(shí)現(xiàn),但第二部分仍然不能實(shí)現(xiàn),為什么呢。。。。  回復(fù)  更多評(píng)論
            
          評(píng)論共4頁(yè): 上一頁(yè) 1 2 3 4 下一頁(yè) 
          主站蜘蛛池模板: 黄梅县| 宝应县| 金昌市| 铜山县| 巧家县| 芮城县| 吴旗县| 绵阳市| 富民县| 青川县| 会泽县| 台山市| 栾川县| 于都县| 鹰潭市| 枣强县| 台东县| 万盛区| 淳安县| 东丽区| 神池县| 广汉市| 喀喇沁旗| 黄浦区| 盐池县| 泰安市| 云林县| 额济纳旗| 五指山市| 霍林郭勒市| 商丘市| 渝中区| 彩票| 买车| 讷河市| 井陉县| 炉霍县| 莱芜市| 四子王旗| 甘谷县| 西安市|