JSP嵌入FLEX SWF文件出现安全水箱,跨域访问的问题解决方案
2013-02-01 12:11
447 查看
我使用的webwork和spring.各个action在spring中使用scope="prototype"模式.
BaseAction如下:
loginAction.java如下:
但是登陆成功之后,在其他的模块Condition.java中
调用BaseAction的checkNoLogin方法,取得登陆成功之后保存在session中的userSession,为什么会是null呢?
请各位解答一下.或者有其他的方式来验证用户是否登陆成功的方式,谢谢!!!
BaseAction如下:
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.lang.*; import com.opensymphony.webwork.ServletActionContext; import com.opensymphony.xwork.ActionSupport; public class BaseAction extends ActionSupport { protected transient final Log log = LogFactory.getLog(getClass()); private String loginId=""; public String getLoginId() { return loginId; } protected boolean checkNoLogin(){ //getSession().setMaxInactiveInterval(1); HttpSession session = getSession(); loginId = (String)session.getAttribute("userSession"); System.out.println("loginId:"+loginId); if(StringUtils.isBlank(loginId)) { return true; } return false; } /** * Convenience method to get the request * @return current request */ protected HttpServletRequest getRequest() { return ServletActionContext.getRequest(); } /** * Convenience method to get the response * @return current response */ protected HttpServletResponse getResponse() { return ServletActionContext.getResponse(); } /** * Convenience method to get the session */ protected HttpSession getSession() { return getRequest().getSession(); }
loginAction.java如下:
public String login() throws Exception { System.out.println("loginId:"+loginId); System.out.println("password:"+password); if (loginDao.checkUserExists(loginId,password) == false) { addFieldError("loginIdNoExists", "用户名不存在!"); return ERROR; } else if (loginDao.checkUserSuccess(loginId,password) == false) { addFieldError("passwordNoMatch", "用户密码错误!"); return ERROR; } else { System.out.println("login success!"); HttpSession session = getSession(); session.setAttribute("userSession", loginId); System.out.println("成功登录!"); } return SUCCESS; }
但是登陆成功之后,在其他的模块Condition.java中
public String condition() throws Exception { if(checkNoLogin()) return "login"; return SUCCESS; }
调用BaseAction的checkNoLogin方法,取得登陆成功之后保存在session中的userSession,为什么会是null呢?
请各位解答一下.或者有其他的方式来验证用户是否登陆成功的方式,谢谢!!!
相关文章推荐
- Struts2 访问Action和Jsp页面出现的路径问题解决方案之 ---- 为jsp、图片、js、css等获取Web工程的绝对路径的方法
- jsp关于include html、jsp等文件出现乱码问题的解决方案
- 页面中嵌入帆软报表,帆软报表服务器和项目不是一个,出现跨域的问题,解决方案
- Flex Swf 访问本地文件,本地安全沙箱问题
- jsp中include使用html静态文件出现乱码问题
- 网页客户端使用php访问mysql数据时出现NetworkError: 500 Internal Server Error问题的解决方案
- Chrome 浏览器跨域和安全访问问题 使用 chrome的命令行标记:disable-web-security 参数联调线上数据
- mac 下终端访问文件出现“Permission Denied”解决方案
- wcf访问出现的安全问题:the caller was not authenticated by the service.
- 结合阿里云服务器,使用FTP上传和下载文件,出现的问题和解决方案
- mac 下终端访问文件出现“Permission Denied”解决方案
- servlet+jsp开发javaweb项目时加载文件出现FileNotFoundException的问题的解决办法
- Ajax访问Xml Web Service的安全问题以及解决方案
- [解决]WebLogic跨域访问安全问题
- 安装VS2005 SP1出现这样问题“windows 无法访问指定设备、路径或文件。您可能没有合适的权限访问这个项目。”
- 软件安全(一)---解决跨域访问问题
- 解决 在Mac OS下开发html5+JS Chrome 浏览器 跨域 和 安全访问问题
- 读hdfs上的文件时出现Unable to write to output stream问题的解决方案
- jsp页面java+js实现文件下载(并附带解决下载文件名乱码问题-火狐浏览器正常访问)
- 当几个应用访问nginx服务器,而这几个应用与nginx不在同一个域名的时候,可能出现跨域问题