CSDN博客

img haroyy

jsp轻松getParameter

发表于2004/9/20 17:31:00  890人阅读

分类: J2SE WEB

private static final String getParam(ServletRequest request, String name,
    String defval)
{
    String param = request.getParameter(name);
    return (param != null ? param : defval);
}

private static final int getParam(ServletRequest request, String name,
    int defval)
{
    String param = request.getParameter(name);
    int value = defval;
    if (param != null) {
 try { value = Integer.parseInt(param); }
 catch (NumberFormatException ignore) { }
    }
    return value;
}

0 0

相关博文

我的热门文章

img
取 消
img