【发布时间】:2013-05-04 00:33:40
【问题描述】:
这是一个可以抛出异常的示例按钮:
<h:commandButton value="save" update=":formTable:tableData">
<f:setPropertyActionListener value="BTN_ONE"
target="#{tamplateTableBean.buttonSelected}" />
</h:commandButton>
在我的ExceptionHandler 我有:
FacesContext.getCurrentInstance().getExternalContext().redirect("error.xhtml");
当我使用<h:commandButton>(如上例)并发生异常时,将执行重定向并显示错误页面。
当我使用<p:commandButton> 时,不会发生重定向(即使执行了redirect("error.xhtml") 行),它将保持在同一页面上,就好像什么都没发生一样。在我的ExceptionHandler 中捕获到异常,但是没有显示 JSF 错误页面。
这是怎么引起的,我该如何解决?
【问题讨论】:
-
技术区别在于 PrimeFaces 按钮发送一个 ajax 请求。 stackoverflow.com/questions/10449862/…
标签: jsf redirect primefaces commandbutton exceptionhandler