jsp登陆页面密码错误时,弹窗提示功能。
想在密码错误时,弹出一个提示窗口,即在下面代码注释的地方,不知道怎么调用js里的函数。。。。。。
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'logincl.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript">
function alert()
{
window.alert("用户名或密码错误!");
}
</script>
</head>
<body>
<%
String u=request.getParameter("username");
String p=request.getParameter("passwd");
if(u.equals("tracy")&&p.equals("000000"))
{
response.sendRedirect("welcome.jsp");
}
else
{
//////////////////////////想在这里给出一个弹窗,就是调用alert(),不知怎么调,求助
response.sendRedirect("login.jsp");
}
%>
</body>
</html>