我已经写好了一个servlet类并测试好了!然后我又加了一个servlet类可是编译是就报错了! No appropriate node to show Web View for "/WebModule1/",but the web server has been start! 难道添加一个类就要改一下地址??
servlet1代码如下:boolean kk = false;
boolean yy = false;
Cookie cookie = null;
Cookie[] cookies = request.getCookies();
response.setContentType(CONTENT_TYPE);
if (cookies != null) {
kk = true;
}
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Cookie 信息</title>");
out.println("</head>");
out.println("<body>");
out.println("所得到的Cookie信息为");
if (kk) {
for (int i = 0; i < cookies.length; i++) {
cookie = cookies[i];
out.println(cookie.getName()+"<br>");
out.println(cookie.getValue() + "<br><br>");
}
yy = true;
} else {
yy = false;
}
if(!yy)
{
String urlPath = request.getContextPath();
String url = response.encodeURL(urlPath+"/servlet2");
out.println("页面将跳转<a href=\""+url+"\">单击此处</a>.");
}
out.println("</body>");
out.println("</html>");
out.close();
servlet2代码是默认的!
servlet问题