Bye,Struts 1

          Posted on 2007-02-28 18:09 Lei 閱讀(1312) 評(píng)論(4)  編輯  收藏 所屬分類(lèi): 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.按類(lèi)型放入文件夾:

          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.建立類(lèi)文件:

          在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下建立的項(xiàng)目名myproject是struts.xml中的namespace,Hello就不再用解釋了。


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

          第一次嘗試Struts2,感覺(jué)比較簡(jiǎn)單。(如果你是Struts1的熱衷者)?
          對(duì)于WW的fans,這次過(guò)渡會(huì)更加容易。因?yàn)镾truts 2 is dependant on XWork 2 (beta-1)。





          Feedback

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

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

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

          2007-02-28 23:16 by Christ Chang
          struts 2和webwork 2的綜合體。不過(guò)個(gè)人覺(jué)得更傾向于webwork。名字叫struts 2不過(guò)是因?yàn)閟truts太有名氣啦

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

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

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

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

          只有注冊(cè)用戶(hù)登錄后才能發(fā)表評(píng)論。


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

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

          Copyright © Lei

          主站蜘蛛池模板: 铁岭县| 兴业县| 大安市| 新竹市| 四子王旗| 阿拉善左旗| 陵水| 营山县| 宽城| 济阳县| 广东省| 昆明市| 保德县| 武鸣县| 大理市| 安康市| 大港区| 呼和浩特市| 监利县| 雅江县| 惠州市| 济宁市| 正阳县| 原平市| 玉田县| 青海省| 红原县| 闽侯县| 于田县| 江安县| 清流县| 临泽县| 崇仁县| 兴安盟| 渝中区| 鸡泽县| 桦南县| 景德镇市| 凉山| 苏尼特左旗| 宁津县|