首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > Java > java 论坛系统源码下载(Struts 2+Hibernate+Spring实现)

java 论坛系统源码下载(Struts 2+Hibernate+Spring实现)

  • 资源大小:1.81M
  • 上传时间:2021-07-22
  • 下载次数:0次
  • 浏览次数:1次
  • 资源积分:1积分
  • 标      签: Web服务/SOAP/RPC

资 源 简 介

Strut2 hibernate spring环境的配置 带有注解package action;import com.opensymphony.xwork2.*;import java.util.*;import javax.servlet.ServletContext;import javax.servlet.http.*;import common.*;import service.*;public class BaseAction extends ActionSupport implements org.apache.struts2.interceptor.ServletRequestAware, org.apache.struts2.interceptor.ServletResponseAware,org.apache.struts2.util.ServletContextAware{ protected ServiceManager serviceManager; protected UserInfo userInfo; protected String result; protected Map cookies; protected javax.servlet.http.HttpServletResponse response; protected javax.servlet.http.HttpServletRequest request; protected ServletContext servletContext; public void setServletResponse(HttpServletResponse response) { this.response = response; } public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; } protected String getCookieValue(String name) { javax.servlet.http.Cookie cookies[] = request.getCookies(); if (cookies != null) { for (Cookie cookie : cookies) { if (!cookie.getName().equals(name)) continue; return cookie.getValue(); } } return null; } public void setServletRequest(HttpServletRequest request) { this.request = request; userInfo.setCookieUser(getCookieValue("user")); } /** * result属性的getter方法 */ public String getResult() { return result; } /** * result属性的setter方法 */ public void setResult(String result) { this.result = result; } public void setServiceManager(ServiceManager serviceManager) { this.serviceManager = serviceManager; } /** * userInfo属性的setter方法 */ public void setUserInfo(UserInfo userInfo) { this.userInfo = userInfo; } protected void saveCookie(String name, String value, int maxAge) { javax.servlet.http.Cookie cookie = new javax.servlet.http.Cookie(name, value); cookie.setMaxAge(maxAge); response.addCookie(cookie); }} 

相 关 资 源

您 可 能 感 兴 趣 的

同 类 别 推 荐

VIP VIP