如何給webwork的action裏的Field設置初始值
jdev說到"爲什麼要放在這裏,而不是放到系統配置文件中,然後在系統設置界面中提供設置",後來我就用spring來注入了。現在就把值放入properties文件中了。
<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>
upload.directory=D:\\tomcat5\\webapps\\files
mail.attachementDirectory=D:\\tomcat5\\webapps\\files
你這樣換了部署環境每次都要改
而且也該是
D://tomcat5//webapps//files"
也許很多人都以爲這是最好的方式,可是實際情況不是這樣,我們的uploadfile目錄已經有3G的文件,而基本上每天我們都要發佈新的webapp,如果把uploadfile目錄放到webapp的一個子目錄,每次部署的時候都要先把uploadfile copy出來然後再部署。所以我們這麼做就是把upload目錄放到其他目錄不影響uploadfile目錄裏面的文件。關於我們項目的部署見我的下一篇文章。謝謝大家。如果您有什麼更好的方法請您指教。