我已经定义了一个自定义标签,如下所示:
<ui:composition>
<h:panelGroup>
<h:panelGrid columns="6" cellpadding="5">
<p:outputLabel for="#{id_prefix}#{fieldId}"
value="#{backingBean.getField(fieldId).label}"
rendered="#{backingBean.getField(fieldId).visible}"/>
<p:selectOneRadio id="#{id_prefix}#{fieldId}"
value="#{backingBean.getField(fieldId).value}"
rendered="#{backingBean.getField(fieldId).visible}"
disabled="#{backingBean.getField(fieldId).disabled}"
partialSubmit="true">
<f:selectItems value="#{backingBean.getField(fieldId).items}" />
<p:ajax disabled="#{not validate}" partialSubmit="true"
update="#{update}"
process="#{not empty process ? process : '@this'}"
listener="#{backingBean.validate(fieldId)}" />
</p:selectOneRadio>
<tas:helpButton backingBean="#{backingBean}" fieldId="#{fieldId}" />
</h:panelGrid>
</h:panelGroup>
我在xhtml视图中使用自定义标记时设置了fieldId
和backingBean
等属性:
<tas:radio backingBean="#{nppFormProcessor}"
fieldId="deckungskonzept"
validate="true" update="generalFields" />
支持bean有一个方法getField(String fieldId)
,它返回Field
类的实例。
使用MyFaces 2.2.3在tomcat 7上运行正常。我想在WebSphere Libery Profile上部署代码,它似乎具有JSF 2.2的内置功能。
当我在WebSphere上运行代码时,我得到以下优点:
/WEB-INF/lib/platform.jar/META-INF/custom-tags/radio.xhtml at line 36 and column 26 value="#{backingBean.getField(fieldId).value}": Property 'getField' not found on type mypackage.FormProcessor_$_javassist_2 at org.apache.myfaces.view.facelets.el.TagValueExpression.getType(TagValueExpression.java:73) at org.apache.myfaces.shared_impl.renderkit._SharedRendererUtils.findUIOutputConverter(_SharedRendererUtils.java:77) at org.apache.myfaces.shared_impl.renderkit.RendererUtils.findUIOutputConverter(RendererUtils.java:407) at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedUISelectOneValue(RendererUtils.java:747) at org.apache.myfaces.shared_impl.renderkit.html.HtmlRadioRendererBase.getConvertedValue(HtmlRadioRendererBase.java:364) at org.primefaces.component.selectoneradio.SelectOneRadioRenderer.getConvertedValue(SelectOneRadioRenderer.java:41) at javax.faces.component.UIInput.getConvertedValue(UIInput.java:664) at javax.faces.component.UIInput.validate(UIInput.java:596) at javax.faces.component.UIInput.processValidators(UIInput.java:277) at org.apache.myfaces.context.servlet.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:550) at org.apache.myfaces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:207) at javax.faces.component.UIComponent.visitTree(UIComponent.java:773) at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1051) at javax.faces.component.UIComponent.visitTree(UIComponent.java:793) at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1051) at javax.faces.component.UIComponent.visitTree(UIComponent.java:793) at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1051) at javax.faces.component.UIComponent.visitTree(UIComponent.java:793) at javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1051) at javax.faces.component.UIForm.visitTree(UIForm.java:290) ..... ....