原意是想密码为空时抛出错误让error.jsp接收显示的,可是调试过后发现每次来到throw new Exception(info + "密码不能为空");  都会出现错我,因为如果填写正确的话是可以正确跳转到success.jsp的,请各位看看我的代码哪里出现错误了???谢谢
<%@ page language="java" import="java.io.*" pageEncoding="GB2312"%>
<%@ page info="错误信息:"%>
<%@ page errorPage="error.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>123</title>
</head> <body>
<%
String userName = request.getParameter("userName");
String userPwd = request.getParameter("userPwd");
String info = getServletInfo();
if (userName.length() == 0 && userName != null)
throw new Exception(info + "用户名不能为空");
if (userPwd.length() == 0 && userPwd != null)
throw new Exception(info + "密码不能为空"); %>
<jsp:forward page="success.jsp" /> </body>
</html>
/***********************error.jsp************************/
<%@ page language="java" import="java.io.*" isErrorPage="true" pageEncoding="GB2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head> <title>ErrorPage</title> </head> <body>
<%
out.println(exception.getMessage());
 %>
</body>
</html>