Session.java
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:2k
- package com.gforce.currency;
- /**
- * <p>Title: 吉力科技办公自动化系统</p>
- * <p>Description: 吉力科技办公自动化系统</p>
- * <p>Copyright: 版权所有 2003 (c) 西安吉力科技发展有限公司 Copyright (c) 2003 GForce Sceince & Technology</p>
- * <p>Company: 西安吉力科技发展有限公司 (GForce Sceince & Technology)</p>
- * @author 马登军
- * @version 1.0
- */
- import javax.servlet.http.*;
- public class Session
- {
- private HttpSession m_request;
- public Session()
- {
- }
- public Session(HttpSession t_session)
- {
- m_request = t_session;
- }
- public void SetRequest(HttpSession t_session)
- {
- m_request = t_session;
- }
- public String GetString(String ParamentName)
- {
- String strReturnValue ="";
- try
- {
- strReturnValue = (String) m_request.getAttribute(ParamentName);
- if (strReturnValue != null)
- strReturnValue = StringNew.SessionGetDecode(strReturnValue);
- }
- catch(Exception err)
- {
- SystemOut.OutPrintLine("从Session中获取String数据“" + ParamentName + "”时出错:" + err.getMessage());
- }
- return strReturnValue;
- }
- public float GetFloat(String ParamentName)
- {
- float numTempValue = 0;
- try
- {
- numTempValue = Float.parseFloat(m_request.getAttribute(ParamentName).
- toString());
- }
- catch (Exception err)
- {
- SystemOut.OutPrintLine("从session获取Float数据“" + ParamentName + "”时出错:" + err.getMessage());
- }
- return numTempValue;
- }
- public int GetInt(String ParamentName)
- {
- int numTempValue = 0;
- try
- {
- numTempValue = Integer.parseInt(m_request.getAttribute(ParamentName).
- toString());
- }
- catch (Exception err)
- {
- SystemOut.OutPrintLine("从session获取Int数据“" + ParamentName + "”时出错:" + err.getMessage());
- }
- return numTempValue;
- }
- public void SetValue(String strObjName,Object objValue)
- {
- m_request.setAttribute(strObjName,StringNew.SessionSetEncode((String)objValue));
- }
- }