急,无法弹出Jjava脚本,请高手帮帮忙
<%@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=request.getParameter("username");
String pd=request.getParameter("password");
if((ue!=null) && (pd!=null))
{ String sql="select * from user where username ='"+ue+"' and password ='"+pd+"'";
ResultSet rt;
rt=jdbc.query(sql);
if(rt.next())
{session.setAttribute("username",ue);}
else
{out.print("<script language='javascript'>alert('用户名、密码错误');</script>");}
}
else
{out.print("<script language='javascript'>alert('请输入用户名、密码');</script>");}%>
<script>
var ur ='<%=ue%>'
var pw ='<%=pd%>'
</script><html>
<head>
<link href="/jsp-examples/C/chxnet.css" rel="stylesheet" type="text/css">
<title>提交页面</title>
<script language="javascript">function aa() {alert(ur);alert(pw);}</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>
我想检验一下request.getParameter("username")是否从上一页面取得参数,用javascript实现,黑体部分为实现代码,但不知为什么总弹不出java脚本
我检查过了ie没有禁用脚本,真不知道是什么原因
------解决方案--------------------<script >
var ur = ' <%=ue% > ' ;
var pw = ' <%=pd% > ' ;
</script >
把aa()调用放在后边试试
<script>
aa();
</script>
</body >
</html >