Review_struts2.x

1.struts2.x povides features to reduce xml configuration via intelligent defaults,utilizes

annotations and provides conventions over configuration.Actions are now POJOs which increases

testability and reduces coupling in the framework, and HTML form field data is converted to proper

types for the action to use.
2.Struts2 is a pull-MVC (or MVC2)framework; this is slightly different from a traditional MVC
framework in that the action takes the role of the model rather than the controller, although there

is some overlap.
3.The struts.properties configuration file  provides a mechanism to change the default behavior of

the framework.
4.A familiar technique for most web developers is to place the object that needs to be accessed in

the HttpServletRequest or the HttpSession. This can be achieved by implementing the “aware”

interface (letting the dependency injection to do its work) and then setting the object to be

accessed under the required name.
5.The value stack is exactly what it says it is – a stack of objects. OGNL stands for Object Graph

Navigational Language, and provides the unified way to access objects within the value stack.
6.
<action name=”*/*” method=”{2}”
class=”com.infoq.actions.{1}Action”>
<result type=”redirect”>/{1}/view.action</result>
<result name=”view”>/{1}/view.jsp</result>
<result name=”input”>/{1}/edit.jsp</result>
<result name=”home”>/{1}/home.jsp</result>
</action>
The action will need to extend the ActionSupport class (providing validation and error message

handling implementations) and implement the ModelDriven and Preparable interfaces. The interceptor

stack along with the two interfaces is the key to making the implementation easy, so let’s
take a look at those in more detail.
也可分开来定义:
 <action name="List" class="tutorial.action.BookAction" method="list">
            <result>List.jsp</result>
        </action>
//list是BookAction中的一个方法.
7.上传文件时要用到
commons-fileupload-1.2.jar
commons-io-1.1.jar 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值