如何给webwork的action里的Field设置初始值(续)

前面一篇文章提到通过webwork的interceptor给webwork的action设置初始值,

如何给webwork的action里的Field设置初始值

网友jdev说到"为什么要放在这里,而不是放到系统配置文件中,然后在系统设置界面中提供设置",后来我就用spring来注入了。现在就把值放入properties文件中了。

     < bean  id ="propertyPlaceholderConfigurer"  class ="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" >
      
< property  name ="locations" >
        
< list >
          
< value > classpath:mail.properties </ value >
          
< value > classpath:upload.properties </ value >
        
</ list >
      
</ property >
    
</ bean >
    
<!--  收发外部邮箱 author:somebody -->
    
< bean  id ="outMailManager"  class ="cn.com.fivefortunes.mail.manager.impl.OutMailManagerImpl" >
        
< property  name ="javaMailSender" >< ref  bean ="javaMailSender" /></ property >
        
< property  name ="attachementDirectory" >< value > ${mail.attachementDirectory} </ value ></ property >
        
< property  name ="uploadFileDirectory" >< value > ${upload.directory} </ value ></ property >
        
< property  name ="outMailHibernateManager" >< ref  bean ="outMailHibernateManager" /></ property >
        
< property  name ="outMailAccountManager" >< ref  bean ="outMailAccountManager" /></ property >
    
</ bean >
这样把uploadFileDirectory放入mananger中去了。在properties里面配置一下就ok了。

upload.directory
= D://tomcat5//webapps//files
mail.attachementDirectory
= D://tomcat5//webapps//files
上次还有网友这样说到"return ServletActionContext.getServletContext().getRealPath("/");

你这样换了部署环境每次都要改
而且也该是
D://tomcat5//webapps//files"
也许很多人都以为这是最好的方式,可是实际情况不是这样,我们的uploadfile目录已经有3G的文件,而基本上每天我们都要发布新的webapp,如果把uploadfile目录放到webapp的一个子目录,每次部署的时候都要先把uploadfile copy出来然后再部署。所以我们这么做就是把upload目录放到其他目录不影响uploadfile目录里面的文件。关于我们项目的部署见我的下一篇文章。谢谢大家。如果您有什么更好的方法请您指教。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值