Oracle JDeveloper 11.1.1.3
ADF Faces Rich Components
ADF Business Components
As you might know already, from logging out to ADF Application you can set 'Destination' property of af:goLink to your desired page.
The Logout can also handled programmatically by server side code in managed-bean.
To do so, af:commandLink can be used something like below.
The managed bean code -
ADF Faces Rich Components
ADF Business Components
As you might know already, from logging out to ADF Application you can set 'Destination' property of af:goLink to your desired page.
<af:goLink text="Logout" id="gl2"
destination="/adfAuthentication?logout=true&end_url=/faces/login.jspx"
accessKey="L" shortDesc="Logs-out current user session."/>
The Logout can also handled programmatically by server side code in managed-bean.
To do so, af:commandLink can be used something like below.
<af:commandLink text="Logout" id="cl2"
action="#{dataentry_bean.onLogout}"
immediate="true"
shortDesc="Logs-out current user session."
accessKey="L"/>
Setting Immediate=true is optional, and it is for bypassing any validation on page.The managed bean code -
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import weblogic.servlet.security.ServletAuthentication;
public String onLogout(){
FacesContext fctx = FacesContext.getCurrentInstance();
ExternalContext ectx = fctx.getExternalContext();
String url = ectx.getRequestContextPath() + "/adfAuthentication?logout=true&end_url=/faces/login.jspx";
HttpSession session = (HttpSession)ectx.getSession(false);
session.invalidate();
HttpServletRequest request = (HttpServletRequest)ectx.getRequest();
ServletAuthentication.logout(request);
ServletAuthentication.invalidateAll(request);
ServletAuthentication.killCookie(request);
try{
ectx.redirect(url);
}
catch(Exception e){
e.printStackTrace();
}
fctx.responseComplete();
return null;
}