0
我正在迁移我的项目从seam 2到JSF 2.x。JSF 2,noSelectionOption与转换器,不工作,因为它应该
在缝2,枚举的,我们有
<s:convertEnum />
当选择正确的值不是noSelectionOption值将调用转换器。
在JSF 2.x的我创建了像
@Named("enumConverter")
@ApplicationScoped
public class EnumConverter implements Converter {
public Object getAsObject(FacesContext context, UIComponent component, String key)
throws ConverterException {
if(!key.equalsIgnoreCase("-- Choose one --")){
// DO LOGIC
}
return null;
}
public String getAsString(FacesContext context, UIComponent component, Object object) {
}
现在我的自定义转换器的问题,我认为我使用 转换器像
<h:selectOneMenu value="#{user.DocumentType}" required="true">
<f:selectItem itemLabel="-- Choose one --" itemValue="#{null}" noSelectionOption="true"/>
<f:selectItems value="${user.Constants(user.statuses)}"
var="Val" itemLabel="#{user.Display(Val)}"
/>
<f:converter converterId="enumConverter"></f:converter>
</h:selectOneMenu>
这儿如果我选择NoSelectionOption然后我的转换器正在调用,,,这不应该发生,只有在需要正确值时才应该调用
仅在接缝2转换器的情况下,如果选择了正确的值,则只有转换器将被调用,否则将调用“需要值”被显示。
请请告诉我,我在这里失踪.... 提前欣赏和帮助......
感谢