简体   繁体   English

JSF组件渲染器中的JSF标签

[英]JSF tags in JSF component renderer

Can i somehow add JSF tags to my JSF component renderer class? 我可以以某种方式将JSF标签添加到我的JSF组件渲染器类中吗? I'm trying in this way: 我正在尝试以这种方式:

        writer.append("<f:param name=\"active\" value=\""+tabName+"\"/>");

But, this tag is not recognized by compiler as JSF tag. 但是,编译器无法将该标签识别为JSF标签。

Adding JSF tag in renderer which is invoked in Renderer response phase is too late and won't work. 在渲染器响应阶段调用的渲染器中添加JSF标记为时已晚,将无法使用。 You need to modify components tree in java or override renderer according what you want to do. 您需要在Java中修改组件树或根据您想要的操作覆盖渲染器

EDIT after comment 评论后编辑
So you do this in jsf page like in this example . 因此,您可以在jsf页面中执行此操作,如本例所示 You need to notice that <f:param> need to be a child element of <h:commandLink> tag. 您需要注意, <f:param>必须是<h:commandLink>标记的子元素。 I think your question is about to how to pass parameters to next page. 我认为您的问题是关于如何将参数传递到下一页。 This can be done by creating appropriate <f:param> way, or ususing hidden inputs fields like you do in Struts. 这可以通过创建适当的<f:param>方式或像在Struts中一样使用隐藏的输入字段来完成。 In both cases you need to have field in backing bean to store the value or get it from request. 在这两种情况下,您都需要在后备bean中有一个字段来存储值或从请求中获取值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM