You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by mfaine <mf...@knology.net> on 2005/02/14 17:50:51 UTC

param not being passed in command button

I have a List box and a command button:

List box:
<h:selectOneListbox id="document" value="#{sessionData.selectedDocumentId}"
size="5" style="width: 300px;" required="true" >
  <f:selectItems id="documentItem" value="#{sessionData.documentSelectItems}"/>
</h:selectOneListbox>


Command Button:
<h:commandButton action="#{sessionData.editAction}"
value="#{msg.common_edit}"
actionListener="#{sessionData.currentDocumentListen}" >
  <f:param name="id" value="#{sessionData.selectedDocumentId}"/>
</h:commandButton>

When I check the contents of the parameter map on the next page I get:

10:35:14,634 DEBUG NasaGeneralBean:? - jsf_state_64 = H4sIAAAAAAAAALVae2...
10:35:14,634 DEBUG NasaGeneralBean:? - _id1:_link_hidden_ = 
10:35:14,634 DEBUG NasaGeneralBean:? - _id1:_id21 = Edit
10:35:14,634 DEBUG NasaGeneralBean:? - _id1_SUBMIT = 1
10:35:14,644 DEBUG NasaGeneralBean:? - jsf_tree_64 = H4sIAAAAAA...
10:35:14,644 DEBUG NasaGeneralBean:? - jsf_viewid = /pages/main.jsp
10:35:14,644 DEBUG NasaGeneralBean:? - _id1:document = 1

As you can see there is no 'id' param being passed.

The value for the 'document' param is also strange because
sessionData.selectedDocumentId was changed
in the currentDocumentListen method before the edit action executed so it
would be reasonable to assume that the 'document' param should contain the
new value for sessionData.selectedDocumentId

The edit action was responsible for providing the outcome that set
navigation to this page. 

It seems the value for 'document' is not being set by the actionListener or
the original value is being passed in the request for some strange reason.

Any help would be appreciated, all I want to do is pass a parameter in the
request, it shouldn't be this hard.


Thanks,
-Mark


Re: param not being passed in command button

Posted by Sean Schofield <se...@gmail.com>.
<f:param> definitely works.  I used it in an example where I had
several <h:commandLink> items in a table.  It will put the parameter
in the request map as promised.    I would double check your example.

sean

On Mon, 14 Feb 2005 08:51:00 -0800 (PST), mfaine <mf...@knology.net> wrote:
> I have a List box and a command button:
> 
> List box:
> <h:selectOneListbox id="document" value="#{sessionData.selectedDocumentId}"
> size="5" style="width: 300px;" required="true" >
>   <f:selectItems id="documentItem" value="#{sessionData.documentSelectItems}"/>
> </h:selectOneListbox>
> 
> Command Button:
> <h:commandButton action="#{sessionData.editAction}"
> value="#{msg.common_edit}"
> actionListener="#{sessionData.currentDocumentListen}" >
>   <f:param name="id" value="#{sessionData.selectedDocumentId}"/>
> </h:commandButton>
> 
> When I check the contents of the parameter map on the next page I get:
> 
> 10:35:14,634 DEBUG NasaGeneralBean:? - jsf_state_64 = H4sIAAAAAAAAALVae2...
> 10:35:14,634 DEBUG NasaGeneralBean:? - _id1:_link_hidden_ =
> 10:35:14,634 DEBUG NasaGeneralBean:? - _id1:_id21 = Edit
> 10:35:14,634 DEBUG NasaGeneralBean:? - _id1_SUBMIT = 1
> 10:35:14,644 DEBUG NasaGeneralBean:? - jsf_tree_64 = H4sIAAAAAA...
> 10:35:14,644 DEBUG NasaGeneralBean:? - jsf_viewid = /pages/main.jsp
> 10:35:14,644 DEBUG NasaGeneralBean:? - _id1:document = 1
> 
> As you can see there is no 'id' param being passed.
> 
> The value for the 'document' param is also strange because
> sessionData.selectedDocumentId was changed
> in the currentDocumentListen method before the edit action executed so it
> would be reasonable to assume that the 'document' param should contain the
> new value for sessionData.selectedDocumentId
> 
> The edit action was responsible for providing the outcome that set
> navigation to this page.
> 
> It seems the value for 'document' is not being set by the actionListener or
> the original value is being passed in the request for some strange reason.
> 
> Any help would be appreciated, all I want to do is pass a parameter in the
> request, it shouldn't be this hard.
> 
> Thanks,
> -Mark
> 
>