struts 最近使用心得

1. struts.propeties  不能改变大小写 - - !失败呀!找了半天问题。同时这个貌似不能改变位置,我在web.xml中加载它所在的位置不摆我。所以老老实实的放在外面

    这里面的可以放一些常量配置,这里能配置的,在struts.xml中通过常量都能配,举例说明:

struts.action.extension=do,action  这个是propeties中的配置在struts.xml中对应<constant name="struts.action.extension" value="do,action" />这个表示请求结尾可以是.do和.action,但是我试验得出可以直接写。如list.do可以直接list。

 

2.命名空间,最好package的name最好都写上,层次清楚,在请求地址的时候也都加上比如:products/list.do。这个可以直接写list.do但是不知道它属于哪个包里面的,系统会默认去所有包里面找,加上package可以有相同的请求只是包不一样。users/list.do 和products/list.do

 

3.<include file="struts_xml/interceptors-struts.xml"></include>可以在不同位置,呵呵

 

4. struts.xml中如果

<action name="login" class="com.ssh.books.web.actions.LoginAction">
   <result name="success">/book/success.jsp</result>
   <result name="error">/book/error.jsp</result>
  </action>

没指方法名称,则默认执行LoginAction中的execute()的方法。

 

5.ActionContext 和ServletActionContext基本相同,都可以实现Context,request,reponse等,能使用前者使用前者。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值