【发布时间】:2013-01-31 16:45:28
【问题描述】:
在我的网络应用程序中,我无法使用单个验证器获取查询参数的键值。
我的网页:
<f:metadata>
<f:viewParam name="version" value="#{myBean.version}"
validator="#{myBean.inputValidator}" />
<f:viewParam name="mobilemodel" value="#{myBean.mobileModel}"
validator="#{myBean.inputValidator}" />
<f:event listener="#{myBean.preRenderViewEventHandler}"
type="preRenderView" />
</f:metadata>
我的组件验证功能:
public void inputValidator(FacesContext context, UIComponent component, Object value) throws ValidatorException {
LOG.debug("Component: " + component);
LOG.debug("Value: " + value);
}
我在UIComponent 中找不到键值(例如version)
一个很好的解决方案是为每个查询参数设置一个验证器函数。有没有办法理解参数的名称?
下一个问题:是否可以跳过所有 Validators 并为 myBean 设置值?我试过了,但是myBean.mobileModel中没有设置值
【问题讨论】:
标签: jsf javabeans meta-tags validation query-parameters