日期:2014-05-18  浏览次数:20881 次

请各位高手帮我看一下,无法弹出javaxcript脚本
<%@page contentType="text/html;charset=gb2312" language="java"%>
<%@page import="cn.ac.ict.*"%>
<%@page import="java.sql.*"%>
<%@page import="javax.servlet.*"%>  
<%@page import="javax.servlet.http.*"%>
<%@page import="javax.servlet.http.HttpServletResponse"%>

<jsp:useBean id="jdbc" scope="session" class="cn.ac.ict.jdbc"/>
<%String ue=new String(request.getParameter("username").getBytes("8859_1")); 
  String pd=new String(request.getParameter("password").getBytes("8859_1"));
  if(ue==null && pd==null)
 {out.print("<script language='JavaScript'>alter('请输入用户名、密码');</script>");}
  else
  { String sql="select * from usertest where UNAME ='"+ue+"' and UPASS ='"+pd+"'";
  ResultSet rt;
  rt=jdbc.query(sql);
  if(rt.next())
  {session.setAttribute("username",ue);}
  else
  {out.print("<script language='JavaScript'>alter('用户名、密码错误');</script>");}
  }%>
<script>
var ue = '<%=ue%>'
var pd = '<%=pd%>'
</script>
<html>
<head>
<link href="/jsp-examples/C/chxnet.css" rel="stylesheet" type="text/css">
<title>提交页面</title>
<script language="javascript">function aa () {alert(ue);alert(pd);}</script>
</head>
<body onload=aa()>
<table width="201" height="200" cellspacing="0" cellpadding="0" bgcolor="#3E85DB">
<tr height="54" valign="middle"><td colspan=2 ><img src="/jsp-examples/images/logtu1.gif"></td></tr>
<tr><td>欢迎您:</td><td><%=session.getAttribute("username")%></td><tr>
<tr><td><input type="button" value="退出" onSubmit="1.jsp"></td></tr>
</table>
</body>
</html>


上面是我的Jsp代码,其它的部分都能正常显示并能正确运行,只有我加粗的那部分javascript脚本怎么也弹不出来,不知为什么


------解决方案--------------------
看看编译后的jsp页面有么有你加粗的那些代码,可以给浏览器中的代码贴上来看看
------解决方案--------------------
IE安全限制?
------解决方案--------------------
是alert not alter
hehe
------解决方案--------------------
alert();
------解决方案--------------------
alert( '请输入用户名、密码 ');