繁体   English   中英

JSF将隐藏的输入发送到另一个jsf

[英]JSF sending a hidden input to another jsf

我有以下代码:

<h:commandLink action="#{clController.action()}" 
    value="#{item.code}" >
    <input type="hidden" name="address" value="#{item.address}" />
    <input type="hidden" name="address" value="#{item.name}" />
    <input type="hidden" name="address" value="#{item.taxDept}" />
</h:commandLink>

页面列出了12个以上的链接。 我想做的就是将所有这些隐藏物发送给另一个jsf,无论用户单击哪个。

当我单击commandLink时,它将转到其他页面。 但是如何显示这些值?

  1. 您不能在JSF中直接使用<input />

  2. 您的输入具有相同的名称。

  3. 在JSF中,发布的值与操作位于同一<h:form />中(如果未指定)。

您可以使用一些简单的参数:

<h:commandLink action="start" actionListener="#{clController.actionListener}">
    <f:attribute name="item" value="#{item}" />
</h:commandLink>

public void actionListener(ActionEvent event)
{
    ClDataModel item = (ClDataModel)event.getComponent().getAttributes().get("item");

    System.out.print(item.getTaxDept());
    System.out.print(item.getAddress());
    System.out.print(item.getName());
}

暂无
暂无

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

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