Bye,Struts 1

Posted on 2007-02-28 18:09 Lei 阅读(1296) 评论(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