有解决方案吗?
h:commandButton不会触发GET请求,而是触发POST请求,因此您无法使用它.如果您已经使用JSF 2.0并且目标页面位于相同的上下文中,那么您可以使用h:按钮:
<h:button value="press here" outcome="otherViewId">
<f:param name="param1" value="value1" />
<f:param name="param2" value="value2" />
</h:button>
(此处不需要h:表格,如h:outputLink).这将创建一个按钮,该按钮转到otherViewId.jsf?param1 = value1& param2 = value2.
但是如果你还没有使用JSF 2.0,那么你最好的方法就是抓住CSS来设置链接样式.
<h:outputLink styleClass="button">
有类似的东西
a.button {
display: inline-block;
background: lightgray;
border: 2px outset lightgray;
cursor: default;
}
a.button:active {
border-style: inset;
}
翻译自:https://stackoverflow.com/questions/3004620/jsf-commandbutton-url-parameters