Re: CommandButton with parameters

Splash Forums PrettyFaces Users CommandButton with parameters Re: CommandButton with parameters

#21137

I’m glad to hear you got it working. :)

I think you figured it out correctly. When you return something like “pretty:employeeForm” from a JSF action method PrettyFaces has to build the correct URL of the mapping to redirect the user to this URL. Therefore PrettyFaces tries to read the current values of the path and query parameters. In your second example you are using EL-injected query parameters and you populate these values correctly using f:setPropertyActionListener components. So this should work fine.

If you are using something like “#{action}” in your path parameter, PrettyFaces will translate the path parameter into a query parameter that you read using the standard Servlet API. But if you are using something like “#{empList.selectedAction}”, PrettyFaces will simply inject the value into the referenced bean property. Both ways have their advantages and disadvantages. I myself prefer the latter one, but that’s just my personal opinion! :)

But I think you are right! Perhaps we should really implement this fallback behavior of reading #{param['action']}. I’ll check if this is easily possible. I currently don’t know if this may cause any side effects. But I’ll check this.

Thanks for the feedback! We are always happy to receive any kind of suggestions of enhancements! :)

Christian