简单问题,郁闷中!问题解决就结贴,在线等!12点前结帖 String home= request.getParameter("home") != null ?request.getParameter :("home"):"" ;试一试 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这样写不太好,要调用两次,这样:String home= request.getParameter("home");home = home==null ? "":home;给你个简单通用的:public class WebUtil { public static final String getParam(ServletRequest request, String name, String defval) { String param = request.getParameter(name); return (param != null ? param : defval); } public 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; }}这样调用:String home = WebUtil.getParam(request,"home",""); String home = request.getParameter("home") == null ? "" : request.getParameter("home"); 我知道怎么搞了!上面这句话变成的字符!要写成:String home = request.getParameter("home") == null ? "" : request.getParameter("home"); if(home.equals("null") home="";就ok了joydsj(刘天) 我也和你一样的想法,但是jdk就是要和我们开玩笑!我也不明白呀 ajax问题,请高手指教 跪求 验证码 代码 jsp struts框架下的 iBATIS问题。会报错吗? 怪异的问题,tomcat 关于startup.bat 启动的问题!! 达人请进!!!! JSP中引用.oxc控件....请教!! JSP中集合如何传递 帮助,谁有jfreechart热点图表实例 原创:ajax中文解决方案 如何限制上传空间的大小? 文件存放到ORACLE中的BLOB下,怎么不能超过4K??? 连数据库出错,急,在线 关于文件写入的问题。
这样写不太好,要调用两次,这样:String home= request.getParameter("home");
home = home==null ? "":home;
给你个简单通用的:public class WebUtil { public static final String getParam(ServletRequest request, String name,
String defval) {
String param = request.getParameter(name);
return (param != null ? param : defval);
} public 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;
}
}这样调用:
String home = WebUtil.getParam(request,"home","");
我知道怎么搞了!
上面这句话变成的字符!
要写成:
String home = request.getParameter("home") == null ? "" : request.getParameter("home");
if(home.equals("null")
home="";
就ok了joydsj(刘天)
我也和你一样的想法,但是jdk就是要和我们开玩笑!
我也不明白呀