属性“xxxxxx”在 org.richfaces.component.UIRepeat 类型上找不到
我将从 JSF 1.2 升级到 JSF 2,从 Richfaces 3.3 升级到 4。 我尝试过各种版本的 JSF2(2.02、2.06 等),但都给出了相同的错误。
我收到以下错误,这个错误已经让我头疼了好几个小时了!
SEVERE: Error Rendering View[/my-testfile.xhtml]
javax.el.PropertyNotFoundException: /templates/components-navigation.xhtml @31,54 rendered="#{component.allowed}": Property 'allowed' not found on type org.richfaces.component.UIRepeat
/templates/components-navigation.xhtml
<a4j:outputPanel rendered="#{loginBean.loggedIn}">
<a4j:repeat var="menugroup" value="#{componentNavigator.groups}">
<a4j:region rendered="#{menugroup.itemCount > 0}">
<div class="panel_menu">
<table class="title" border="0" width="100%">
<tr>
<td>
<h:outputText class="text" value="#{messages[menugroup.id]}" />
</td>
</tr>
</table>
<table class="links" border="0" width="100%">
<tbody>
<a4j:repeat var="component" value="#{componentNavigator.components}">
<a4j:region rendered="#{component.allowed}">
<a4j:region rendered="#{component.groupId == menugroup.id}">
<tr class="#{component.current?'active':'unactive'}">
<td> </td>
<td class="text" width="100%">
<h:commandLink action="#{component.getCommandAction}" actionListener="#{componentNavigator.initControllerBean}">
<span style="display:block;">
#{messages[component.id]}
</span>
<f:attribute name="controllerBean" value="#{component.controllerBean}" />
<f:setPropertyActionListener target="#{componentNavigator.currentComponent}" value="#{component}" />
</h:commandLink>
</td>
</tr>
</a4j:region>
</a4j:region>
</a4j:repeat>
</tbody>
</table>
</div>
</a4j:region>
</a4j:repeat>
</a4j:outputPanel>
第 31 行是:
<a4j:region rendered="#{component.allowed}">
有什么想法为什么没有找到该属性吗?重复组件是否存在已知问题?
I'm upgrading from JSF 1.2 to JSF 2 and Richfaces 3.3 to 4.
I've tried various version of JSF2 (2.02, 2.06, etc) and all give the same error.
I'm getting the following error that has been hurting my head for hours now!
SEVERE: Error Rendering View[/my-testfile.xhtml]
javax.el.PropertyNotFoundException: /templates/components-navigation.xhtml @31,54 rendered="#{component.allowed}": Property 'allowed' not found on type org.richfaces.component.UIRepeat
/templates/components-navigation.xhtml
<a4j:outputPanel rendered="#{loginBean.loggedIn}">
<a4j:repeat var="menugroup" value="#{componentNavigator.groups}">
<a4j:region rendered="#{menugroup.itemCount > 0}">
<div class="panel_menu">
<table class="title" border="0" width="100%">
<tr>
<td>
<h:outputText class="text" value="#{messages[menugroup.id]}" />
</td>
</tr>
</table>
<table class="links" border="0" width="100%">
<tbody>
<a4j:repeat var="component" value="#{componentNavigator.components}">
<a4j:region rendered="#{component.allowed}">
<a4j:region rendered="#{component.groupId == menugroup.id}">
<tr class="#{component.current?'active':'unactive'}">
<td> </td>
<td class="text" width="100%">
<h:commandLink action="#{component.getCommandAction}" actionListener="#{componentNavigator.initControllerBean}">
<span style="display:block;">
#{messages[component.id]}
</span>
<f:attribute name="controllerBean" value="#{component.controllerBean}" />
<f:setPropertyActionListener target="#{componentNavigator.currentComponent}" value="#{component}" />
</h:commandLink>
</td>
</tr>
</a4j:region>
</a4j:region>
</a4j:repeat>
</tbody>
</table>
</div>
</a4j:region>
</a4j:repeat>
</a4j:outputPanel>
Line 31 is:
<a4j:region rendered="#{component.allowed}">
Any ideas why the property is not been found? Is there a know issue with the repeat component?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
#{component}
是一个保留的隐式 EL 对象,它引用当前的 JSF 组件。它可以按如下方式使用:在上面的示例中,
#{component}
解析为UIInput
实例表示当前
,该实例又具有isValid()
方法。提交后,当组件出现验证错误时,将设置error
样式类(例如可能具有微红色背景色),否则将设置ok
样式类被设置。就像 JavaScript 中的this
一样。您应该为作用域变量指定不同的名称。不要不要在 JSF 中使用以下保留 EL 对象之一的名称:
#{component}
- 当前的UIComponent
#{facesContext}
-当前FacesContext
#{request}
- 当前的HttpServletRequest
#{session}
- 当前的HttpSession
#{application}
-ServletContext
# {cc}
- 当前复合组件#{param}
-当前请求参数映射#{requestScope}
- 当前请求属性映射#{component}
is a reserved and implicit EL object which refers to the current JSF component. It can be used as follows:In the above example, the
#{component}
resolves to anUIInput
instance representing the current<h:inputText>
, which in turn has aisValid()
method. Upon submit, when the component has a validation error, theerror
style class will be set (which may have for example a reddish background color), else theok
style class will be set. It's like asthis
in JavaScript.You should give your scoped variables a different name. Do not use the name of one of the following reserved EL objects in JSF:
#{component}
- the currentUIComponent
#{facesContext}
- the currentFacesContext
#{request}
- the currentHttpServletRequest
#{session}
- the currentHttpSession
#{application}
- theServletContext
#{cc}
- the current composite component#{param}
- the current request parameter map#{paramValues}
- the current request parameter values map#{requestScope}
- the current request attribute map#{viewScope}
- the current view attribute map#{sessionScope}
- the current session attribute map#{applicationScope}
- the application attribute map#{header}
- the current request header map#{cookie}
- the current request cookie map您的“组件”bean 需要一个
and
方法。属性是 bean 中的一个字段,它需要公共 getter 和 setter 方法。大多数 IDE 支持生成这些方法,请注意“Source -->Generate Getter and Setter”之类的内容。
另一种可能性是直接调用方法。例如,
使用 bean 代码
如果您已经在您的 componentNavigator bean 中使用了 getter 和 setter,那么如果您可以将其发布到此处(或其中的一部分),那么将会很有用。
理查德
Your 'component' bean needs a
and
method. A property is a field in your bean, which needs a public getter and setter method. Most IDEs support generating those methods look out for something like "Source --> Generate Getter and Setter".
Another possibility would be to call a method directly. Something like,
with a bean code
If you've already getter and setter in your componentNavigator bean it would be usefull if you could post it here (or parts of it).
Richard
我将:更改
为:
,现在一切都很好了:)
我偶然发现了这个问题,这给了我线索:
https://issues.jboss.org/browse/RF-8026
I changed:
to:
and it's all good now :)
I stumbled across this issue which gave me the clue:
https://issues.jboss.org/browse/RF-8026