简体   繁体   English

如何注销JSF应用程序

[英]How to Logout in a JSF application

I have to use my Company login resource and, how can I set the logout servlet into my primefaces component? 我必须使用我的公司登录资源 ,如何将注销servlet设置为我的primefaces组件?

How "translate" this... 如何“翻译”这个...

//in a jsp page:
<a href="<%=request.getContextPath()%>/servlet/com.app.ServletEndSession?initialPage=/index.jsp" > Logout </a>

...into this: ...变成这样:

<p:commandButton type="button" value="Logout" action="??" />

Thanks in advance. 提前致谢。

您的<a/>应该成为

<p:button href="#{facesContext.externalContext.requestContextPath}/servlet/com.app.ServletEndSession?initialPage=/index.jsp" value="Dialogit"/>

You could just use a managed bean on the commandButton and then do a redirect in your page? 您可以只在commandButton上使用托管bean,然后在页面中进行重定向? As you definitely want to navigate away with p:commandbutton youw would want to set ajax="false" put action . 正如您肯定要使用p:commandbutton导航一样,您将需要设置ajax =“ false” put action。

Alternatively you could just use 或者,您可以只使用

<p:commandButton type="button" value="logout" onclick="javascriptTolinkToServletEndEsssion" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM