struts2 如何支持 velocity-tools 的 toolbox ?

在struts.xml里配置

<constant name="struts.velocity.toolboxlocation" value="/WEB-INF/toolbox.xml"></constant>

然后再WEB-INF/toolbox.xml 下面加上:toolbox.xml

<?xml version="1.0"?>
<toolbox>
 <tool>
  <key>link</key>
  <scope>request</scope>
  <class>
   org.apache.velocity.tools.struts.StrutsLinkTool
     </class>
 </tool>
 <tool>
  <key>msg</key>
  <scope>request</scope>
  <class>
   org.apache.velocity.tools.struts.MessageTool
     </class>
 </tool>
 <tool>
  <key>errors</key>
  <scope>request</scope>
  <class>
   org.apache.velocity.tools.struts.ErrorsTool
     </class>
 </tool>
 <tool>
  <key>form</key>
  <scope>request</scope>
  <class>
   org.apache.velocity.tools.struts.FormTool
     </class>
 </tool>
 <tool>
  <key>tiles</key>
  <scope>request</scope>
  <class>
   org.apache.velocity.tools.struts.TilesTool
     </class>
 </tool>
 <tool>
  <key>validator</key>
  <scope>request</scope>
  <class>
   org.apache.velocity.tools.struts.ValidatorTool
     </class>
 </tool>
</toolbox>

struts 与 velocity 整合以后,有哪些内置的变量可以直接用?

 

  • req - the current HttpServletRequest
  • res - the current HttpServletResponse
  • stack - the current OgnlValueStack
  • ognl - an instance of OgnlTool
  • ui - a (now deprecated) instance of a ui tag renderer

转载于:https://www.cnblogs.com/ly-dayu/archive/2013/01/14/2859606.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值