我们有一个自定义 JSF 组件,它以特定方式呈现一些按钮和一个选择框。这是由扩展的类完成的UIInput
。xhtml
模板中使用的这个自定义组件如下所示:
<xx:fooComponent
value="#{fooBean.someProperty}"
valueChangeListener="#{fooBean.someMethodInBean}"
someOtherProperties="true" />
现在,由于我们从运行 JSF 2.0 的 JBoss 4.2.2 更改为运行内置 JSF 库的 JBoss 7.1.1,它抱怨someMethodInBean
不是属性。当然,它不是属性,而是方法。世界上谁会将一个属性绑定到一个valueChangeListener
?
起初我以为,这与方法在被引用 bean 的超类中有关,但事实并非如此。添加此特定方法FooBean
没有任何区别。
所以我的问题是,他们做了什么改变,所以现在就坏了,我怎样才能以适合迁移的方式修复它?
编辑
该组件在我们的*.taglib.xml
:
<!DOCTYPE facelet-taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
<!-- ... -->
<tag>
<tag-name>fooComponent</tag-name>
<component>
<component-type>myProject.FooComponent</component-type>
</component>
</tag>
...这导致了以下声明faces-config.xml
:
<component>
<component-type>myProject.FooComponent</component-type>
<component-class>com.myproject.somemore.UIFooComponent</component-class>
</component>
...这导致类UIFooComponent extends UIInput
。
编辑 2
现在taglib
xml看起来像这样:
<facelet-taglib version="2.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd">
<tag>
<tag-name>fooComponent</tag-name>
<component>
<component-type>myProject.FooComponent</component-type>
</component>
<attribute>
<name>valueChangeListener</name>
<method-signature>void valueChanged(javax.faces.event.ValueChangeEvent)</method-signature>
</attribute>
</tag>
</facelet-taglib>
尽管如此,他还是抱怨fooBean
没有财产someMethodInBean
。
编辑 3
堆栈跟踪是:
Caused by: javax.el.ELException: /abc/abc.xhtml: The class 'com.myproject.managedbeans.foo.FooBean' does not have the property 'someMethodInBean'.
at com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:94)
at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:302)
at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
at org.apache.myfaces.tomahawk.application.ResourceViewHandlerWrapper.renderView(ResourceViewHandlerWrapper.java:93)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
... 21 more