JSF向另一个jsf发送隐藏的输入 [英] JSF sending a hidden input to another jsf

查看:64
本文介绍了JSF向另一个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个上面的链接。我想把所有这些hiddens发送给另一个用户点击的jsf。

Page lists more than 12 links like above. What i want to do sending all these hiddens to another jsf whichever user clicks.

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

When I click commandLink it goes other page. But How can I show these values?

推荐答案


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

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

Your inputs have all the same name.

在JSF中,发布的值是同一< h:form /> 内的值作为操作(如果没有指定)。

In JSF, values posted are the one inside the same <h:form /> as the action (if not specified).

你可以使用简单的东西作为参数:

You can use something simple as a parameter :

<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());
}

这篇关于JSF向另一个jsf发送隐藏的输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆