Reputation: 993
I have to use my Company login resource and, how can I set the logout servlet into my primefaces component?
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.
Upvotes: 0
Views: 748
Reputation: 20691
Your <a/>
should become
<p:button href="#{facesContext.externalContext.requestContextPath}/servlet/com.app.ServletEndSession?initialPage=/index.jsp" value="Dialogit"/>
Upvotes: 1
Reputation: 1263
You could just use a managed bean on the commandButton and then do a redirect in your page? As you definitely want to navigate away with p:commandbutton youw would want to set ajax="false" put action .
Alternatively you could just use
<p:commandButton type="button" value="logout" onclick="javascriptTolinkToServletEndEsssion" />
Upvotes: 0