在JSF 2中执行操作后导航到同一页面 [英] Navigate to the Same Page After Action in JSF 2

查看:98
本文介绍了在JSF 2中执行操作后导航到同一页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在JSF 1.x中完成的组件,该组件具有如下的命令按钮

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

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

templateController作为EL绑定传递的地方,可以是实现特定接口的任何对象. 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 ""; 
}

现在,我正在尝试将该组件移植到JSF 2,我的问题是,空字符串不会再导致同一页面刷新,相反,框架尝试将其重定向到名为".jsf"的页面,即只需将.jsf附加到任何结果即可.我的问题是如何返回导致当前页面刷新的结果.我的组件是通用的,我事先不知道将在其上使用的页面的名称.

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.

谢谢

推荐答案

改为返回null或仅声明方法void.

Return null instead or just declare method void.

这篇关于在JSF 2中执行操作后导航到同一页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆