You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Alessandro Polverini <al...@nibbles.it> on 2005/06/05 22:59:02 UTC

f:param not correctly passed inside h:commandButton?

Hello,
I'm playing with parameters to pass to functions called from actions of
h:commandButton and h:commandLink, and I find different behaviours:
namely it does not work with commandButtons.

Both commands are inside a table, these are my two test cases:

First one with commandLink:
<h:column>
 <h:commandLink action="#{myBean.myMethod}">
  <h:outputText value="Select"/>
  <f:param name="myParam" value="#{row.myValue}"/>
 </h:commandLink>
</h:column>

And Second one with commandButton
<h:column>
 <h:commandButton action="#{myBean.myMethod}" value="Select">
   <f:param name="myParam" value="#{row.myValue}"/>
 </h:commandButton>
</h:column>

The method called on the bean is the same, and this is the code:
Map rpm = FacesContext.getCurrentInstance().getExternalContext
().getRequestParameterMap();
logger.debug("-- BEGIN --");
for (Object key : rpm.keySet())
  logger.debug("key "+key+" : "+rpm.get(key));
logger.debug("-- END --");

With commandLink I have a correct behavior:
20050605 22:52:40 logParameterMap - -- BEGIN --
[ ... not useful parameters ...]
20050605 22:52:40 logParameterMap - key myParam : 2
20050605 22:52:40 logParameterMap - key autoScroll : 0,0
20050605 22:52:40 logParameterMap - -- END --

While using the commandButton myParm is empty! :
20050605 22:52:40 logParameterMap - -- BEGIN --
[ ... not useful parameters ...]
20050605 22:52:40 logParameterMap - key myParam :
20050605 22:52:40 logParameterMap - key autoScroll : 0,0
20050605 22:52:40 logParameterMap - -- END --

I tried both with release 1.0.9 and night build, the problem is the
same.

I suppose that's a bug in myfaces, can someone please confirm I'm not
doing something dumb so I open an issue on Jira?

Thanks,
Alex



Re: f:param not correctly passed inside h:commandButton?

Posted by Martin Marinschek <ma...@gmail.com>.
Hmmm...

I wonder what we would need to render if a button has params.

Would we render params as hidden fields?

regards,

Martin

On 6/5/05, Alessandro Polverini <al...@nibbles.it> wrote:
> Hello,
> I'm playing with parameters to pass to functions called from actions of
> h:commandButton and h:commandLink, and I find different behaviours:
> namely it does not work with commandButtons.
> 
> Both commands are inside a table, these are my two test cases:
> 
> First one with commandLink:
> <h:column>
>  <h:commandLink action="#{myBean.myMethod}">
>   <h:outputText value="Select"/>
>   <f:param name="myParam" value="#{row.myValue}"/>
>  </h:commandLink>
> </h:column>
> 
> And Second one with commandButton
> <h:column>
>  <h:commandButton action="#{myBean.myMethod}" value="Select">
>    <f:param name="myParam" value="#{row.myValue}"/>
>  </h:commandButton>
> </h:column>
> 
> The method called on the bean is the same, and this is the code:
> Map rpm = FacesContext.getCurrentInstance().getExternalContext
> ().getRequestParameterMap();
> logger.debug("-- BEGIN --");
> for (Object key : rpm.keySet())
>   logger.debug("key "+key+" : "+rpm.get(key));
> logger.debug("-- END --");
> 
> With commandLink I have a correct behavior:
> 20050605 22:52:40 logParameterMap - -- BEGIN --
> [ ... not useful parameters ...]
> 20050605 22:52:40 logParameterMap - key myParam : 2
> 20050605 22:52:40 logParameterMap - key autoScroll : 0,0
> 20050605 22:52:40 logParameterMap - -- END --
> 
> While using the commandButton myParm is empty! :
> 20050605 22:52:40 logParameterMap - -- BEGIN --
> [ ... not useful parameters ...]
> 20050605 22:52:40 logParameterMap - key myParam :
> 20050605 22:52:40 logParameterMap - key autoScroll : 0,0
> 20050605 22:52:40 logParameterMap - -- END --
> 
> I tried both with release 1.0.9 and night build, the problem is the
> same.
> 
> I suppose that's a bug in myfaces, can someone please confirm I'm not
> doing something dumb so I open an issue on Jira?
> 
> Thanks,
> Alex
> 
> 
>