Possible to pass `p:inputText` parameters via `f:param`? [closed]

你说的曾经没有我的故事 提交于 2019-12-13 09:08:42

问题


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?

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>

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");

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

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.


回答1:


This worked:

xhtml:

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

java bean:

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

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



来源:https://stackoverflow.com/questions/13975026/possible-to-pass-pinputtext-parameters-via-fparam

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!