纳闷?帮忙看看,一个小问题
下面是我的原码,很简单大家一看就明白。可为什么就达不到我想要的效果呢?当我什么也不输入的时候,他还是做 out.print("您的名字是:"+user);
formtest.html
<html>
<head>
<title>提交测试</title>
</head>
<body>
请输入您的名字:<br>
<!-- 添加一个表单 -->
<form method=post action="saveform.jsp">
<input type="text" name="user" size=10 >
<input type="submit" name="submit" value="提交">
</form>
</body>
</html>
saveform.jsp
<%@ page language="java" %>
<html>
<head>
<title>输出用户的名字</title>
</head>
<body>
<!-- 提交表单后的响应 -->
<% String user=request.getParameter("user");%>
<%
if(user==null){
%>
<p>你的名字不能为空
<%
} else {
out.print("您的名字是:"+user);
}
%>
</body>
</html>