allow objects as value of parameters in p:commandButton

UI Components for JSF
Post Reply
rubus
Posts: 517
Joined: 01 Oct 2010, 09:41
Location: Belgium

01 Oct 2010, 09:49

Hi all,

I'm using 2.2.M1 and i tried to use some parameters in the commandbutton like this:

Code: Select all

                <p:commandButton actionListener="#{logicalDevicesInLogicalDeviceGroupComponent.updateLogicalDevicesInGroup}" ajax="false"
                                 action="/pages/configuration/logicalDeviceGroupList.jsf" value="#{msg['page.logicalDevicesInGroup.button.save']}">
                    <f:param name="parkId" value="#{logicalDevicesInLogicalDeviceGroupComponent.idLogicalDeviceGroup}"/>
                </p:commandButton>
The problem is that idLogicalDeviceGroup is of type Long and the renderer expects only String values.

Code: Select all

public class CommandButtonRenderer extends CoreRenderer {

...

	protected String buildNonAjaxRequest(FacesContext facesContext, CommandButton button, String formId) {
...
                request.append(addSubmitParam(formId, param.getName(), (String) param.getValue()));
...
	}
...
}
This forced me to use an additional method in the backing bean getIdLogicalDeviceGroupAsString() that does the convertion to String. Code could be adjusted to do the convertion itself ->

Code: Select all

 param.getValue().toString()
.

Regards

Rudy De Busscher

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests