Request.java
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:3k
- 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 Request {
- private HttpServletRequest m_request;
- public Request() {
- }
- public Request(HttpServletRequest t_request) {
- m_request = t_request;
- }
- public void SetRequest(HttpServletRequest t_request) {
- m_request = t_request;
- }
- public String getQueryString() {
- return StringNew.RequestGetDecode(m_request.getQueryString());
- }
- public String GetString(String ParamentName) {
- String strTempValue = "";
- try {
- String[] strTempValues = new String[0];
- strTempValues = m_request.getParameterValues(ParamentName);
- for (int i = 0; i < strTempValues.length; i++) {
- strTempValue += "," + StringNew.RequestGetDecode(strTempValues[i]);
- }
- if(strTempValue!="")
- {
- strTempValue = strTempValue.substring(1);
- }
- }
- catch (Exception err) {
- SystemOut.InfoOut("从Request获取字符串变量组“" + ParamentName + "”的值时出错!");
- try {
- strTempValue = m_request.getParameter(ParamentName);
- if (strTempValue != null) {
- strTempValue = StringNew.RequestGetDecode(strTempValue);
- }
- else
- {
- strTempValue = "";
- }
- }
- catch (Exception e) {
- SystemOut.InfoOut("从Request获取字符串变量“" + ParamentName + "”的值时出错!");
- }
- }
- return strTempValue;
- }
- public float GetFloat(String ParamentName) {
- float numTempValue = 0;
- try {
- numTempValue = Float.parseFloat(m_request.getParameter(ParamentName).toString());
- }
- catch (Exception err) {
- SystemOut.InfoOut("从request获取Float数据时出错:" + err.getMessage());
- }
- return numTempValue;
- }
- public int GetInt(String ParamentName) {
- int numTempValue = 0;
- try {
- numTempValue = Integer.parseInt(m_request.getParameter(ParamentName).toString());
- }
- catch (Exception err) {
- SystemOut.InfoOut("从request获取Int数据时出错:" + err.getMessage());
- }
- return numTempValue;
- }
- public void SetParament(String strParamentName, String strParamentValue) {
- m_request.setAttribute(strParamentName, StringNew.RequestSetEncode(strParamentValue));
- }
- }