f:param doesn't work with h:commandButton

倖福魔咒の 提交于 2019-12-06 09:46:55
BalusC

In JSF 1.x, the <f:param> is only supported in <h:commandLink>, <h:outputLink> and <h:outputFormat>, not in <h:commandButton>. That support is only in JSF 2.0 and newer.

You have at least 4 options:

  1. Use <h:commandLink> instead. If necessary use CSS to style it to look like a button. See for an example also JSF commandButton URL parameters.

  2. Use <f:attribute> or <f:setPropertyActionListener> instead. See also Communication in JSF.

  3. Pass them as method arguments action="#{myBean.action('param1', 'param2')}". Tomcat 7 is a servlet 3.0 container which supports EL 2.2 which in turn supports passing method arguments. You only need to make sure that your web.xml is declared conform Servlet 3.0. See also Invoking methods with parameters by EL in JSF 1.2.

  4. Upgrade to JSF 2.0. It offers so much advantages over JSF 1.x. See also Migrating from JSF 1.2 to JSF 2.0 and Communication in JSF 2.0.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!