Bye,Struts 1

          Posted on 2007-02-28 18:09 Lei 閱讀(1312) 評論(4)  編輯  收藏 所屬分類: Open Source
          Struts,Apache封存了1系列到1.35版本,而2.06版已經發布。

          Now,let's roll?to try?Struts2 in Eclipse3.

          1.最小安裝文件:

          Filename Description
          struts2-core.jarFramework library itself, found in distribution root directory
          xwork.jarXWork 2 library on which Struts 2 is built (version 2.0 or later)
          ognl.jarObject Graph Navigation Language (OGNL), the expression language used throughout the framework
          freemarker.jarAll UI tag templates are written in Freemarker (also a good option for your own views)
          commons-logging.jarCommons logging, which the framework uses to support transparently logging to either Log4J or JDK 1.4+
          web.xmlJava web application configuration file that defines the filters (and other components) for your web application
          struts.xmlFramework configuration file that defines the actions, results, and interceptors for your application

          2.按類型放入文件夾:

          web.xml????? WEB-INF/
          *.jar?????????? ?WEB-INF/lib/

          3.編輯struts.xml文件:

          <struts>

          ????
          <constant?name="struts.dontspeakfool"?value="false"?/>
          ????
          <constant?name="struts.newrookie"?value="true"?/>

          ????
          <include?file="whoknowsbill.xml"/>

          ????
          <!--?Add?packages?here?-->?
          ????
          ????????
          <package?name="hello"?extends="struts-default"?namespace="/myproject">
          ????????
          <action?name="Hello"?class="hello.Hello">
          ????????????
          <result?name="succ">/hello.jsp</result>
          ????????
          </action>
          ????
          </package>
          ????
          </struts>

          4.建立類文件:

          在src下建立hello/Hello.java:

          package?hello;

          import?com.opensymphony.xwork2.ActionSupport;

          public?class?Hello?extends?ActionSupport?{

          ????@Override
          ????
          public?String?execute()?throws?Exception?{
          ????????
          //?do?sth.
          ????????return?"succ";
          ????}


          }


          5.建立jsp文件:

          在webroot下建立hello.jsp,內容隨意。

          6.在Eclipse下編譯并部署:

          (
          具體步驟省略)

          7.在IE中查看結果:

          http://localhost:8080/Struts2/myproject/Hello.action?

          Struts2為Eclipse下建立的項目名myproject是struts.xml中的namespace,Hello就不再用解釋了。


          Struts1熟透了,目前仍舊流行。在1.26+ 加入了Lazy Action Form,Map backed Form,并對Validator部分增添了新特色,以及1.3的SSL擴展。

          第一次嘗試Struts2,感覺比較簡單。(如果你是Struts1的熱衷者)?
          對于WW的fans,這次過渡會更加容易。因為Struts 2 is dependant on XWork 2 (beta-1)。





          Feedback

          # re: Bye,Struts 1  回復  更多評論   

          2007-02-28 21:09 by 施偉
          這不就是webwork2嘛。。。

          # re: Bye,Struts 1  回復  更多評論   

          2007-02-28 23:16 by Christ Chang
          struts 2和webwork 2的綜合體。不過個人覺得更傾向于webwork。名字叫struts 2不過是因為struts太有名氣啦

          # re: Bye,Struts 1  回復  更多評論   

          2007-03-02 09:13 by Welkin Hu
          我們公司現在用Tapstry

          # re: Bye,Struts 1  回復  更多評論   

          2007-03-02 22:49 by Druze.libo
          兩者合并是各取所需
          struts的龐大用戶群
          webwork的技術和思想

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          posts - 1, comments - 4, trackbacks - 0, articles - 0

          Copyright © Lei

          主站蜘蛛池模板: 三河市| 柏乡县| 顺义区| 鹤壁市| 额尔古纳市| 囊谦县| 拜泉县| 湖口县| 新邵县| 安顺市| 乡城县| 大姚县| 嘉义县| 巍山| 盐山县| 沙雅县| 隆子县| 谢通门县| 西城区| 八宿县| 成武县| 黔西| 九寨沟县| 肥东县| 河北省| 城固县| 四平市| 普定县| 抚宁县| 乐陵市| 桃园县| 大洼县| 襄樊市| 东乡族自治县| 龙山县| 云安县| 砚山县| 习水县| 云龙县| 汕头市| 会同县|