复合属性在jsf自定义组件中返回null [英] composite attributes returns null in jsf custom components
本文介绍了复合属性在jsf自定义组件中返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在实现我的自定义组件,如下所示.将此文件放置在Web->资源文件夹中
I am implementing my custom component like below. Placed this file web-> resource folder
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:composite="http://java.sun.com/jsf/composite"
>
<h:body>
<composite:interface>
<composite:attribute name="width" default="300"/>
<composite:attribute name="height" default="400"/>
</composite:interface>
<composite:implementation>
<h:inputText style="height: #{composite.attrs.height}px"></h:inputText>
<span> #{composite.attrs.height}</span>
</composite:implementation>
</h:body>
</html>
但是attrs.height不返回任何内容.
but attrs.height return nothing.
自定义组件的使用方式如下
Custom component is used like below
<my:mycustom height="40"></my:mycustom>
我在这里犯了什么错误.任何人都可以帮助我做到这一点.
What i have done mistakes here. Anyone please help me to do this.
推荐答案
我发现了这个问题,使用命名空间作为组合来获取属性(#{composite.attrs.height}) 但这似乎是不正确的,并使用cc而不是Composite及其正确返回.
I have found the issue, used the namespaces as composite to get the attribute(#{composite.attrs.height}) But this is not correct it seems and used cc instead of composite and its returns correctly.
这篇关于复合属性在jsf自定义组件中返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文