【发布时间】:2019-02-25 12:01:06
【问题描述】:
对于我为编辑框设置验证器的表单,例如:
<xp:inputText
id="inpRiskFactors"
styleClass="inputEscalation"
value="#{matterBean.matter.escRiskFactors}"
validator="#{matterValidators.valEscRiskFactors}"...
这是我的验证方法中的一个 sn-p:
public void valEscRiskFactors(FacesContext facesContext, UIComponent component, Object value) {
utils.printToConsole(this.getClass().getSimpleName().toString() + " - valEscRiskFactors(...), value = " + value.toString());
String msg = null;
if (value.toString().replaceAll("\\s+","").equals("")){
msg = matterProp.getProperty("msg_valid_esc_risk_factors");
FacesMessage message = new FacesMessage(msg);
throw new ValidatorException(message);
}
}
我想知道是否可以通过此方法更改/设置调用组件(UIComponent 组件)的 styleclass 属性?
对于用户来说,最好在 xp:controls 上应用一些 CSS,这些 CSS 是必需的,但没有通过验证。
有人知道如何实现这一点吗?
【问题讨论】: