如何显示成功消息,然后在超时(例如5秒)后将用户重定向到另一个页面?
登录成功后,我需要登录页面.我尝试了以下操作,我可以在登录失败时看到警告消息,但不能看到登录成功时的成功消息.它立即显示目标页面.
public String check(){
if (username.equals("test") && password.equals("test")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,"Sample info message", "PrimeFaces rocks!"));
return "Success";
}else{
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN,"Sample warn message", "Watch out for PrimeFaces!"));
return "Failure";
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用Seam的PageFlow进行导航.
我有一个
<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />
Run Code Online (Sandbox Code Playgroud)
在登录页面上.
我有一个带有primefaces数据表的表单,我已经为它设置了css列宽:
.idcol{width: 5%}
.prioritycol{width: 5%}
.titlecol{width: 30%}
.descriptioncol{width: 40%}
.actionscol{width: 10px}
Run Code Online (Sandbox Code Playgroud)
一切都很好但是当我添加scrollable="true"属性以便拥有可滚动的数据表时,结果最糟糕:

这是数据表的声明:
<p:dataTable id="dtable" var="todos" value="#{todo.todoList}" scrollable="true"
resizableColumns="false" scrollHeight="300" lazy="true"
styleClass="idcol,prioritycol,titlecol,descriptioncol,actionscol">
Run Code Online (Sandbox Code Playgroud)
问题是什么?谢谢!
我有一个JSF应用程序,我希望在导航中更改浏览器地址栏中的URL.当我打开Home.xhtml并提交表单时,它会显示下一页AppHome.xhtml,但浏览器地址栏中的URL不会更改.
这是提交按钮:
<p:commandButton value="Connect" update="panel" id="ajax" action="#{user.check}" styleClass="ui-priority-primary"/>
Run Code Online (Sandbox Code Playgroud)
这是导航规则:
<navigation-rule>
<from-view-id>/Home.xhtml</from-view-id>
<navigation-case>
<from-outcome>Success</from-outcome>
<to-view-id>/AppHome.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>Failure</from-outcome>
<to-view-id>/Home.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
Run Code Online (Sandbox Code Playgroud)
执行此导航时,如何更改浏览器地址栏中的URL?
jsf-2 ×3
jsf ×2
primefaces ×2
ajax ×1
css ×1
navigation ×1
redirect ×1
seam ×1
timeout ×1
url ×1