String name = req.getParameter("name"); name = name.length() > 0 ? name : "world"; resp.setContentType("text/html"); PrintWriter pw = resp.getWriter(); pw.write("<h1>Hello, "+name+"!</h1>"); pw.flush();
访问地址:http://localhost:8080/hello/?name=bob
问题:不传name参数就500了,还未找到解决方法
一眼空指针
Sign in to make a reply
jasmine
访问地址:http://localhost:8080/hello/?name=bob
问题:不传name参数就500了,还未找到解决方法