我正在使用春季3.0。 Can i读到一个当地淹没人的财产档案:C:propmylogin.properties(不在网络应用/应用服务器下)
mylogin.properties
login.heading=Login
login.username=Username
login.password_blank=Password cannot be blank
I want to use the above in my Validator class(java bean class). Please Note : I using MultiAction Controller not SpringFormController
public class MyUserValidator implements Validator
{
@Override
public void validate(Object command, Errors errors) {
String msg=null;
//some conditions checked
String msg=login.password_blank;-------->get from property file ??
errors.rejectValue("User",msg,"defaultvalue");
}
然而,我们却使用资源棒,不能确定如何在有效器内使用这一工具?
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource" lazy-init="true">
<property name="basenames">
<list>
<value>${deployment.properties.path}/xyzsite/mylogin</value>
</list>
</property>
<property name="cacheSeconds" value="${deployment.properties.cache_in_seconds}"/>
</bean>
如果使用资源障碍,答案u中究竟有什么变化?
for example if i want to set a PageSize int pagesize=5; ---> get this from property file
mylogin.properties
login.heading=Login
login.username=Username
login.password_blank=Password cannot be blank
login.page_row_size=5