代码源于Fusion Developer Guide for ADF,可以整理成框架的公用代码:
- public String logoutButton_action() throws IOException{
- ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext();
- HttpServletResponse response = (HttpServletResponse)ectx.getResponse();
- HttpSession session = (HttpSession)ectx.getSession(false);
- session.invalidate();
- response.sendRedirect("Welcome.jspx");
- return null;
- )
总结:很多功能代码都可以在Guide中找到,多查找并使用Best practice的内容。