When the action
attribute contains an EL expression, it's interpreted as a method expression. It's thus really only valid when you use action="#{bean.someMethod}"
. However, your attempt does not represent a valid method expression, it's represents instead a value expression which is not accepted by the action
attribute.
If you intend to append additional request/view parameters to the form submit, then you should rather use <f:param>
.
<h:commandButton value="Save Edits" action="editOrDeletePage.xhtml">
<f:param name="editing" value="true" />
<f:param name="id" value="#{product.id}" />
<f:param name="name" value="#{product.productName}" />
<f:param name="description" value="#{product.description}" />
<f:param name="quantity" value="#{product.quantity}" />
</h:commandButton>
Note that those parameters don't end up in the request URL (as you see in the browser address bar) and that your theoretical approach also wouldn't have done that, a JSF command button namely generates a HTML <input type="submit">
element which submits to the very same URL as specified in the action
attribute of the parent HTML <form method="post">
.
Also note that those parameters are not evaluated during the form submit, but during displaying the form. If you intented to pass submitted values along that way, then you're basically doing it wrong. Perhaps you want to specify them as view parameters so that you can use action="editOrDeletePage?faces-redirect=true&includeViewParams=true"
as action.
After all, it's hard to propose the right solution for you as you didn't elaborate the concrete functional requirement in detail at all.