Navigate to the Same Page After Action in JSF 2

大兔子大兔子 提交于 2020-01-03 09:11:26

问题


I have a component done in JSF 1.x, this component has a command button as follows

<h:commandButton ... action="#{templateController.next}" />

Where templateController was passed as an EL binding and can be any object that implements a certain interface. The generic implementation of next() was just executing code and then returning an empty string causing the same page to refresh:

public String next() {

  .....
 return ""; 
}

Now I am trying to port that component to JSF 2, my problem is that an empty string doesn't cause the same page to refresh anymore, instead, the framework tries to redirect to a page called ".jsf" i.e it just appends .jsf to whatever the outcome is. My question is how to return an outcome that causes the current page to refresh. My component is generic and I don't know before hand the name of the page it is going to be used on.

Thanks


回答1:


Return null instead or just declare method void.



来源:https://stackoverflow.com/questions/2777852/navigate-to-the-same-page-after-action-in-jsf-2

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