jsf 2.0 - 将结果作为字符串传递到复合组件中
我正在使用 jsf2 创建一个简单的复合组件,但由于一个愚蠢的问题而陷入困境。
我不知道如何将结果作为参数发送到组合,该结果将用作 commandLink 上的操作。
示例:
<!-- Usage -->
<my:comp myAction="myOutcome" />
<!-- Component -->
<composite:interface>
<composite:attribute name="myAction" required="true" />
</composite:interface>
<composite:implementation>
<h:form>
<h:commandLink action="#{cc.attrs.myAction}" value="Go" />
</h:form>
</composite:implementation>
<!-- Expected result -->
<h:form><h:commandLink action="myOutcome" value="Go" /></h:form>
我已阅读此 主题< /a>,但没有成功。
我发现的唯一解决方案是使用托管 bean 作为重定向器:
<h:commandLink action="#{redirectorBean.go(cc.attrs.myMaction)}" value="Go" />.
有人可以帮助我通过更好(更简单)的解决方案来实现这一目标?
谢谢
I'm creating a simple composite component with jsf2, and i'm stucked because of a stupid problem.
I don't know how to send to the composite an outcome as parameter, which will be used as action on a commandLink.
Exemple :
<!-- Usage -->
<my:comp myAction="myOutcome" />
<!-- Component -->
<composite:interface>
<composite:attribute name="myAction" required="true" />
</composite:interface>
<composite:implementation>
<h:form>
<h:commandLink action="#{cc.attrs.myAction}" value="Go" />
</h:form>
</composite:implementation>
<!-- Expected result -->
<h:form><h:commandLink action="myOutcome" value="Go" /></h:form>
I have read this topic, but without success.
The only solution i've found is to use a managed-bean as redirector :
<h:commandLink action="#{redirectorBean.go(cc.attrs.myMaction)}" value="Go" />.
Someone could help me to achieve this with a better (simpler) solution ?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
属性名称必须为
action
,并且您需要指定复合属性的targets
属性,该属性引用相对的commandlink 客户端ID。用途:
复合组件:
The attribute name must be
action
and you need to specify the composite attribute'stargets
attribute which refers the relative commandlink client ID.Usage:
Composite component: