⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logoutaction.java

📁 一个netstore的完整代码,他使用了j2ee和webservice技术,并使用ojb o/r管理框架,很不错的
💻 JAVA
字号:
package netstore.security;

import java.util.Locale;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import netstore.customer.view.UserView;
import netstore.framework.exceptions.BaseException;
import netstore.framework.SessionContainer;
import netstore.framework.NetstoreBaseAction;
import netstore.framework.util.IConstants;
import netstore.service.INetstoreService;

/**
 * This action is called when a user checks out of the Netstore
 * application.
 */
public class LogoutAction extends NetstoreBaseAction {
  public ActionForward execute( ActionMapping mapping,
                                ActionForm form,
                                HttpServletRequest request,
                                HttpServletResponse response )
    throws Exception {

    HttpSession session = request.getSession(false);
    // Make sure the user has a valid session
    if(session != null) {
      if(getSessionContainer(request) != null) {
        // Login through the security service
        INetstoreService serviceImpl = this.getNetstoreService();
        serviceImpl.logout( getSessionContainer(request).getUserView().getEmailAddress());
        getSessionContainer(request).cleanUp();
      }
      session.invalidate();
    }
    return mapping.findForward( IConstants.SUCCESS_KEY );
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -