Bri*_*hem 11 jsf action composite-component jsf-2
我正在JSF 2中创建一个简单的菜单复合组件.但是,我无法将String属性传递给复合组件以在<h:commandLink>的action属性中使用.我的组件看起来像:
<composite:interface>
<composite:attribute name="title" required="true" type="java.lang.String"/>
<composite:attribute name="view" required="true" />
</composite:interface>
<!--implementation-->
<composite:implementation>
<li><h:commandLink action="#{cc.attrs.view}" value="#{cc.attrs.title}" /></li>
</composite:implementation>
Run Code Online (Sandbox Code Playgroud)
如何将动作String添加到<h:commandLink>的action属性中?
cay*_*ann 23
看起来这吸引了Horstmanns :-)
您必须将属性命名为"action"并使用重定向.然后,一些特殊的处理踢,用精致的清晰度(不是)来描述
http://docs.oracle.com/javaee/6/javaserverfaces/2.0/docs/pdldocs/facelets/composite/attribute.html
以及我不允许粘贴其链接的ViewDeclarationLanguage.retargetMethodExpressions(而不是ViewHandler)的API文档.
这是你如何做到的.
<composite:interface>
<composite:attribute name="title" required="true" type="java.lang.String"/>
<composite:attribute name="action" targets="view" required="true" />
</composite:interface>
<!--implementation-->
<composite:implementation>
<li><h:commandLink id="view" value="#{cc.attrs.title}" /></li>
</composite:implementation>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13817 次 |
| 最近记录: |