⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paramutils.java

📁 完整的合同管理信息系统
💻 JAVA
字号:
/*
 * ParamUtils.java
 *
 * Created on 2004年2月11日, 下午1:58
 */

package com.ICT.AFC.util;

import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author  Administrator
 */

public class ParamUtils
{

    public ParamUtils()
    {
    }

    private static String getString(HttpServletRequest httpservletrequest, String s)
    {
        String s1 = null;
        try
        {
            s1 = httpservletrequest.getParameter(s).trim();
        }
        catch(Exception exception) { }
        return s1;
    }

    public static String getString(HttpServletRequest httpservletrequest, String s, String s1)
        throws Exception
    {
        String s2 = getString(httpservletrequest, s);
        if(s2 == null)
            return s1;
        else
            return s2;
    }

    public static int getInt(HttpServletRequest httpservletrequest, String s, int i)
    {
        try
        {
            String s1 = getString(httpservletrequest, s);
            if(s1 == null)
                return i;
            else
                return Integer.parseInt(s1);
        }
        catch(NumberFormatException numberformatexception)
        {
            return 0;
        }
    }
    public static float getFloat(HttpServletRequest httpservletrequest, String s, float f)
    {
        try
        {
            String s1 = getString(httpservletrequest, s);
            if(s1 == null)
                return f;
            else
                return Float.parseFloat(s1);
        }
        catch(NumberFormatException numberformatexception)
        {
            return 0;
        }
    }
    public static double getDouble(HttpServletRequest httpservletrequest, String s, float f)
    {
        try
        {
            String s1 = getString(httpservletrequest, s);
            if(s1 == null)
                return f;
            else
                return Double.parseDouble(s1);
        }
        catch(NumberFormatException numberformatexception)
        {
            return 0;
        }
    }
    public static long getLong(HttpServletRequest httpservletrequest, String s, long l)
    {
        try
        {
            String s1 = getString(httpservletrequest, s);
            if(s1 == null)
                return l;
            else
                return Long.parseLong(s1);
        }
        catch(NumberFormatException numberformatexception)
        {
            return 0L;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -