Bye,Struts 1

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

          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,內(nèi)容隨意。

          6.在Eclipse下編譯并部署:

          (
          具體步驟省略)

          7.在IE中查看結(jié)果:

          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擴(kuò)展。

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





          Feedback

          # re: Bye,Struts 1  回復(fù)  更多評論   

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

          # re: Bye,Struts 1  回復(fù)  更多評論   

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

          # re: Bye,Struts 1  回復(fù)  更多評論   

          2007-03-02 09:13 by Welkin Hu
          我們公司現(xiàn)在用Tapstry

          # re: Bye,Struts 1  回復(fù)  更多評論   

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

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


          網(wǎng)站導(dǎo)航:
           

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

          Copyright © Lei

          主站蜘蛛池模板: 临夏县| 高雄市| 陆良县| 贡山| 榆林市| 安平县| 平昌县| 娄底市| 博乐市| 军事| 白城市| 广丰县| 清远市| 陆川县| 平远县| 岑溪市| 福州市| 扎兰屯市| 景德镇市| 如东县| 德令哈市| 湘阴县| 阳泉市| 涟源市| 阳高县| 化州市| 台北县| 缙云县| 东方市| 隆尧县| 武夷山市| 达州市| 渭源县| 大同市| 界首市| 瑞昌市| 荣成市| 仙桃市| 泸溪县| 茂名市| 绵阳市|