//out.println(userName); 你这句是怎么回事呢? 你相当于在<html>标记之前输出userName。 //out.println(userName); //结素 out.println("<html>"); out.println("<head><title>newuser</title></head>"); out.println("<body bgcolor=\"#ffffff\">"); out.println("<p>The servlet has received a GET. This is the reply.</p>"); out.println("</body></html>"); } 改一下: //结素 out.println("<html>"); out.println("<head><title>newuser</title></head>"); out.println("<body bgcolor=\"#ffffff\">"); out.println("<p>The servlet has received a GET. This is the reply.</p>"); out.println(userName); out.println("</body></html>"); }
我是想在SERVLET取出值之后输出他打印一下,看是不是把值传过来了,我照你说的做一下,谢谢!~
你可以打印,不过用: System.out.println(userName);
还是不行,我把报错的信息贴出来,我想是不是我的路径有问题?或者是<fotm action = "/newuser" method = "POST">有问题StandardHost[localhost]: MAPPING configuration error for request URI
是不是你tomcat的问题,我没发现代码错误
你相当于在<html>标记之前输出userName。
//out.println(userName);
//结素
out.println("<html>");
out.println("<head><title>newuser</title></head>");
out.println("<body bgcolor=\"#ffffff\">");
out.println("<p>The servlet has received a GET. This is the reply.</p>");
out.println("</body></html>");
}
改一下: //结素
out.println("<html>");
out.println("<head><title>newuser</title></head>");
out.println("<body bgcolor=\"#ffffff\">");
out.println("<p>The servlet has received a GET. This is the reply.</p>");
out.println(userName);
out.println("</body></html>");
}
System.out.println(userName);
**.jsp
<form name="form1" method="post" action="/newuser">或
<form name="form1" method="post" action="/servlet/newuser">
检查一下你的web.xml
我用的是JBX,也存在XML的配置问题吗?XML都是自动升成的啊