可以通过f:param传递p:inputText参数吗? [英] Possible to pass `p:inputText` parameters via `f:param`?

查看:98
本文介绍了可以通过f:param传递p:inputText参数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我看来,p:inputText不支持通过f:param发送参数.这是真的?

It seems to me that p:inputText does not support sending parameters via f:param. Is this true?

如果是,我如何传递参数?

If yes, how could I pass the parameters?

更多详情
我有一个通过以下方式生成的inputText字段的列表:

In more details
I have a list of inputText fields generated via:

<p:dataTable value="#{EncryptionBean.epList}" var="item">
  <p:column>
  ...
     <p:inputText value="#{item.APID}" valueChangeListener="#{EncryptionBean.listenerApid}">
         <f:param value="#{item.presetName}" name="whoLaunched"/>
     <p:inputText>
  </p:column>    
<(p:dataTable>

当我捕获值更改侦听器时,我需要知道inputText属于哪个EncryptionBean.epList.我通常这样做:

When I catch the value change listener, I need to know which of the EncryptionBean.epList does the inputText belong to. I usualy do this with:

ExternalContext ec; 
...
String value = (String)ec.getRequestParameterMap().get("whoLaunched");

...但不适用于inputText(例如,它适用于commandLink).

...but it does not work for inputText (as it worked for commandLink for example).

基本上,如何将item.presetName与itemText值(item.APID)一起传递给侦听器?我需要将这2个保存在地图中.

Basically, how do I pass item.presetName together with itemText value (item.APID) to the listener? I need to save those 2 in the map.

推荐答案

此方法有效:

xhtml:

<p:inputText value="#{item.APID}">
    <p:ajax listener="#{EncryptionBean.listenerApid( item.presetName, item.APID )}"/>              
</p:inputText>

java bean:

java bean:

public void listenerApid( String presetName, String typedAPID )
{       
    // Do something with values.
}

传递这些值非常容易,只需将ajax listener与参数而不是valueChangeListener一起使用即可.

Ubelievable how easy it is to pass those values, just use ajax listener with arguments instead of valueChangeListener.

这篇关于可以通过f:param传递p:inputText参数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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