再探Struts2

                                                                                                                                         Author:Peach

                                                                                                                                         Date:2011-5-18

1.过滤器

a> org.apache.struts2.dispatcher.FilterDispatcher

b> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

这两者有何特点,怎么去区分?

2.在不使用struts.xml的时候,可以采用注解的方式来响应页面

比如:@Action(value="/welcome", results={@Result(name="success", location="/results/successPage.jsp")})这个时候的Action没有实现com.opensymphony.xwork2.Action

使用struts.xml后。可以通过配置result来响应页面

 

3.迭代状态值对应的属性信息

The table show the different properties of the IteratorStatus object.

The table show the different properties of the IteratorStatus object.
Name 	Return Type 	Description
index 	int 	zero-based index value.
count 	int 	index + 1
first 	boolean 	returns true if it is the first element
last 	boolean 	returns true if it is the last element
even 	boolean 	returns true if the count is an even number.
odd 	boolean 	returns true if the count is an odd number.
modulus 	int 	takes an int value and returns the modulus of count. 

 4.关于拦截器:

默认的拦截器,那是必须的。如果你需要使用新的拦截器,比如急自己写的做特定用处的,需要和默认的拦截器组成一个拦截器栈,并将这个拦截器栈作为你默认的拦截器,或者在你的action中配置一个拦截器去拦截请求

 

5.关于验证

页面:在head标签内加入<s:head />,消息的样式就引入进来了

后台:extends ActionSupport,  override validate(),使用类库中的addFieldError(),addActionError()来获取消息内容

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值