ParamUtils.java
上传用户:u_thks
上传日期:2022-07-31
资源大小:1910k
文件大小:2k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

Java

  1. /*
  2.  * Created on 2005-10-7
  3.  * Made In GamVan
  4.  */
  5. package com.gamvan.util;
  6. import javax.servlet.http.HttpServletRequest;
  7. import com.gamvan.tools.TypeChange;
  8. /**
  9.  * 
  10.  * @author GamVan by 我容易么我
  11.  * Powered by GamVan.com
  12.  */
  13. public class ParamUtils {
  14.     public static String getStringParameter(HttpServletRequest request,
  15.             String name)
  16.     {
  17.         String str = "";
  18.         str = TypeChange.nullOfString(request.getParameter(name));
  19.         return str;
  20.     }
  21.     
  22.     
  23.     public static int getIntParameter(HttpServletRequest request,
  24.             String name)
  25.     {
  26.         int i = TypeChange.stringToInt(request.getParameter(name));
  27.         return i ;
  28.     }
  29.     
  30.     
  31.     public static double getDoubleParameter(HttpServletRequest request,
  32.             String name)
  33.     {
  34.         double d = TypeChange.stringToDouble(request.getParameter(name));
  35.         return d;
  36.     }
  37.     
  38.     public static boolean getBooleanParameter(HttpServletRequest request,
  39.             String name)
  40.     {
  41.         boolean b = TypeChange.stringToBoolean(request.getParameter(name));
  42.         return b;
  43.     }
  44.     
  45.     public static long getLongParameter(HttpServletRequest request,
  46.             String name)
  47.     {
  48.         long l = TypeChange.stringToLong(request.getParameter(name));
  49.         return l;
  50.     }  
  51.     
  52.     
  53.     public static byte getByteParameter(HttpServletRequest request,
  54.             String name)
  55.     {
  56.         byte b = TypeChange.stringToByte(request.getParameter(name));
  57.         return b;
  58.     }  
  59.     
  60.     public static short getShortParameter(HttpServletRequest request,
  61.             String name)
  62.     {
  63.         short s = TypeChange.stringToShort(request.getParameter(name));
  64.         return s;
  65.     } 
  66.     
  67. }