jsf在viewscoped bean中自动滚动到顶部

时间:2014-09-25 11:32:57

标签: jsf jsf-2

我有一个viewcoped托管bean并使用preRenderView事件,我在用户进行选择时重新加载页面,并且需要根据此选择更改内容。

<f:event listener="#{mybean.initialize()}" type="preRenderView"/>

现在,当页面重新加载时,它会滚动到顶部,为了查看更新的内容,您必须向下滚动。我希望在页面重新加载时显示更新的内容而不向下滚动。 我尝试过使用带有facescontext的重定向,如下所示:

  FacesContext context = FacesContext.getCurrentInstance();
  context.getExternalContext().redirect(contacthistory.xhtml#showform");

但是,这种方法不起作用,因为bean是再次创建的。我发现了许多使用javascript和jquery的方法,但我根据项目要求无法使用javascript。那么,我该如何实现这种向下滚动呢?

0 个答案:

没有答案