response.sendRedirect("../Index.htm");
解决方案 »
- 据说flex要被淘汰,现在想用APPLET弄浏览器控件;现在APPLET可有钱途啊。。大神们给点建议啊!
- SSH整合时有多个applicationContext.xml文件的配置问题`
- 框架刷新
- 一个弱弱的问题的,传说的中的分页技术!
- 怎样实现提前提醒的问题
- 请教,我的这段下载文件的代码该如何修改?
- javax.servlet包不存在?
- 我的程序怎么不可以編譯啊
- servlet中能否象jsp一样调用java bean啊!回答的一定给分
- Java虚拟机规范规定了对空对象的引用和数组的越界访问会抛出异常吗?
- jbuilder9中的中文注释怎么变成乱码了?
- Tomcat中数据库驱动程序的配置问题(在线等待)
<%@ page contentType="text/html;charset=gb2312" language="java" import="java.sql.*,java.util.Date" errorPage="" %>
<HTML>
<HEAD>
<TITLE>欢迎光临高中会考网站</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<style type="text/css">
td, p, li {font-family:宋体;font-size:9pt;}
A {TEXT-DECORATION: none; TEXT-TRANSFORM: none}
A:link {text-decoration: none; color: #333333;font-size:9pt}
A:visited {text-decoration: none; color: #333333;font-size:9pt}bb
A:active {text-decoration: underline;font-size:9pt}
A:hover {text-decoration: underline; color: #FF8300;font-size:9pt}
.unnamed1 {
font-size: 9pt;
line-height: 9pt;
}
</style>
<LINK href="../Script/my_style.css" type=text/css rel=stylesheet>
<SCRIPT language=javascript src="../Script/bar_ctrl.js"></SCRIPT>
<SCRIPT language=javascript src="../Script/bar_init.js"></SCRIPT></HEAD><script language="javascript">
function FN_Check()
{
if(document.sub.logname.value == "")
{
alert("登录名不能为空,请重新输入!");
document.sub.logname.focus();
return false;
}
if(document.sub.password.value == "")
{
alert("密码不能为空,请重新输入!");
document.sub.password.focus();
return false;
}
return true;
}
</script><BODY leftMargin=0 topMargin=0 onload=init(); bgproperties="fixed" background="../Images/Main_bg.gif">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="756" height="10" id="AutoNumber1" bgcolor="#FFFFFF">
<tr>
<td height="10" bordercolor="#000000" valign="bottom" background="../Images/Main_top.gif" width="756" style="border-left:1px solid #000000; border-right:1px solid #000000; font-family: 宋体; font-size: 9pt"></td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="756" height="60" id="AutoNumber1" background="../Images/Top_bg.jpg" bgcolor="#336699">
<tr>
<td height="60" bordercolor="#000000" valign="bottom" width="11" style="font-family: 宋体; font-size: 9pt; border-left-style:solid; border-left-width:1; border-right-width:1; border-top-width:1; border-bottom-width:1"> </td>
<td height="60" bordercolor="#000000" valign="bottom" width="473" style="font-family: 宋体; font-size: 9pt"> </td>
<td height="60" bordercolor="#000000" width="13" style="font-family: 宋体; font-size: 9pt; border-left-width:1; border-right-style:solid; border-right-width:1; border-top-width:1; border-bottom-width:1">
</td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-left-style:solid; border-left-width:1; border-right-style:solid; border-right-width:1; border-top-width:1; border-bottom-width:1" bordercolor="#111111" width="756" height="18" id="AutoNumber5" background="../Images/Menu/idx_bar_p.gif">
<tr>
<td width="19" height="18" background="../Images/Menu/idx_bar_b.gif" style="border-left-width: 1; border-right-width: 1; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#808080">
</td>
<td width="101" background="../Images/Menu/idx_bar_b.gif" style="border-left-width: 1; border-right-width: 1; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#808080" valign="top">
<img border="0" src="..\Images/logo_bottom.gif" width="83" height="12"></td>
<td width="100" background="../Images/Menu/idx_bar_b.gif" style="border-left-width: 1; border-right-width: 1; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#808080">
<a href="file:///C|/Tomcat4/webapps/ROOT/britney/Index.htm">
<img id=button0 border="0" src="..\Images/Menu/i_bar_0a.gif" name=button0 align="left" width="100" height="25"></a></td>
<td width="100" background="../Images/Menu/idx_bar_b.gif" style="border-left-width: 1; border-right-width: 1; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#808080">
<font color="#666666"> <a id="menu1" href="div_th.htm"> <img id=button1 border="0" src="..\Images/Menu/i_bar_1a.gif" name=button1 width="100" height="25"></a></font></a></font></td>
<td width="100" background="../Images/Menu/idx_bar_b.gif" style="border-left-width: 1; border-right-width: 1; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#808080">
<a id="menu2" href="div_ds.htm">
<font color="#666666">
<img id=button2 border="0" src="..\Images/Menu/i_bar_4a.gif" name=button2 width="100" height="25"></font></a></font></td>
<td width="100" background="../Images/Menu/idx_bar_b.gif" style="border-left-width: 1; border-right-width: 1; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#808080">
<a id="menu3" href="div_cd.htm">
<font color="#666666">
<img id=button3 border="0" src="..\Images/Menu/i_bar_5a.gif" name=button3 width="100" height="25"></font></a></font></td>
<td width="100" background="../Images/Menu/idx_bar_b.gif" style="border-left-width: 1; border-right-width: 1; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#808080">
<a id="menu4" href="div_pr.htm">
<font color="#666666">
<img id=button4 border="0" src="..\Images/Menu/i_bar_6a.gif" name=button4 width="100" height="25"></font></a></font></td>
<td width="100" background="../Images/Menu/idx_bar_b.gif" style="border-left-width: 1; border-right-width: 1; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#808080">
<a id="menu5" href="div_sc.htm">
<font color="#666666">
<img id=button5 border="0" src="..\Images/Menu/i_bar_7a.gif" name=button5 width="100" height="25"></font></a></font></td>
<td width="36" background="../Images/Menu/idx_bar_b.gif" style="border-left-width: 1; border-right-width: 1; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#808080">
</td>
</tr>
</table>
</center>
</div>
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-left-style:solid; border-left-width:1; border-right-style:solid; border-right-width:1; border-top-width:1; border-bottom-width:1" bordercolor="#111111" width="756" height="511" id="AutoNumber1" bgcolor="#FFFFFF">
<tr>
<td height="1" colspan="5" bordercolor="#000000" width="756"> <SCRIPT language=javascript src="../Script/bar_cont.js"></SCRIPT>
<!--/////////////////导航条代码结束//////////////////-->
dou代表你存放Index.htm的文件夹名。
</tr>
<tr>
<td height="50" colspan="5" bordercolor="#000000" valign="bottom" background="../Images/Greybar1.gif" width="756"></td>
</tr>
<tr>
<td height="361" bordercolor="#000000" width="20" rowspan="6"> </td>
<td height="21" bordercolor="#000000" width="728" colspan="4" valign="middle">
<a href="index.htm">首页</a>>></td>
</tr>
<tr>
<td height="314" bordercolor="#000000" width="143" align="center" valign="top" rowspan="4">
<iframe name="I1" scrolling="no" border="0" frameborder="0" width="155" height="90" src="..\Modules/Logon.htm" target="_parent">
您的浏览器不支持嵌入式框架。</iframe>
<iframe name="I6" scrolling="no" border="0" frameborder="0" width="155" height="110" src="..\Modules/Score.htm" target="_parent">
您的浏览器不支持嵌入式框架。</iframe>
<iframe name="I6" scrolling="no" border="0" frameborder="0" width="155" height="115" src="..\Modules/Application.htm" target="_parent">
您的浏览器不支持嵌入式框架。</iframe></td>
<td height="312" bordercolor="#000000" width="44" rowspan="4" valign="top" background="../Images/line02.gif">
</td>
<td height="27" bordercolor="#000000" width="462" valign="top"> <p style="line-height: 150%">
<b><font size="3" color="#333333"> <img border="0" src="..\Images/Title_front.gif" width="12" height="12"></font><font size="2" color="#555555">
用户登陆</font></b>
<hr style="height: 5px">
</td>
<td height="340" bordercolor="#000000" width="58" rowspan="5" background="../Images/line02.gif"> </td>
</tr>
<tr>
<td height="272" bordercolor="#000000" width="462" valign="top">
<form method="POST" name="sub">
<P> </P>
<P align="center"> <font size="2"> 用户名:
<input type="text" name="logname" size="20">
</font></P>
<P align="center"><font size="2"> 密 码:
<input type="password" name="password" size="20">
</font></P>
<P align="center"><font size="2">用户类型:
<input type="radio" name="usersort" value="admin">
管理员</font></P>
<P align="center"><font size="2">
<input type="radio" name="usersort" value="staff">
工作人员</font></P>
<P align="center"><font size="2">
<input type="radio" name="usersort" value="student" checked>
考生</font></P>
<CENTER>
<P align="center"><font size="3"><font color="#666666" size="2"> 找回密码 新用户注册</font></font></P>
<P align="center">
<input type="submit" value="提交" name="g" onclick="return FN_Check();">
<input type="reset" value="取消" name="B2">
</P>
</center>
</form>
</td>
</tr> <tr>
<td height="18" bordercolor="#000000" width="462" valign="top">
<p style="line-height: 150%"><font color="#555555">
</font><font color="#555555"> </font></td>
</tr>
<tr>
<td height="18" bordercolor="#000000" align="center" width="681" colspan="3">
<p style="line-height: 150%"> </td>
</tr>
<tr>
<td height="38" colspan="5" bordercolor="#000000" align="center" width="756">
<iframe name="I5" target="_parent" scrolling="no" border="0" frameborder="0" width="720" height="30" src="..\Modules/Bottom.htm" align="center">
您的浏览器不支持嵌入式框架。</iframe></td>
</tr>
<tr>
<td height="17" colspan="5" bordercolor="#000000" align="center" bgcolor="#333333" width="756">
td>
</tr>
</table>
</center>
</BODY></HTML>
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:beibei";
Connection con=DriverManager.getConnection(url);
out.print("数据库连接成功,恭喜你");Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); String usersort = request.getParameter("usersort");
String logname = request.getParameter("logname");
//String password = request.getParameter("password");if(usersort!=null&&logname!=null)
{
String sql="select password from " + usersort + " where logname = '" + logname + "'";
out.print(sql);
ResultSet rs=stmt.executeQuery(sql);
if(rs.next())
{ //out.print("数据库连接成功,恭喜你");
response.sendRedirect("../Index.htm");
//String str=response.encodeRedirectURL("student.jsp");
//response.sendRedirect("str");
}
else
{
out.print("用户名或者密码错误,请重新输入!");
}
rs.close();
}
stmt.close();
con.close();
%>
<完〉
__________________________________________________
注意这:你的表单似乎没有提交
<P> </P>
<P align="center"> <font size="2"> 用户名:
<input type="text" name="logname" size="20">
</font></P>
<P align="center"><font size="2"> 密 码:
<input type="password" name="password" size="20">
</font></P>
<P align="center"><font size="2">用户类型:
<input type="radio" name="usersort" value="admin">
管理员</font></P>
<P align="center"><font size="2">
<input type="radio" name="usersort" value="staff">
工作人员</font></P>
<P align="center"><font size="2">
<input type="radio" name="usersort" value="student" checked>
考生</font></P>
<CENTER>
<P align="center"><font size="3"><font color="#666666" size="2"> 找回密码 新用户注册</font></font></P>
<P align="center">
<input type="submit" value="提交" name="g" onclick="return FN_Check();">
<input type="reset" value="取消" name="B2">
</P>
</center>
</form>
<html>
<head>
</head><script language="javascript">
function FN_Check()
{
if(document.sub.logname.value == "")
{
alert("登录名不能为空,请重新输入!");
document.sub.logname.focus();
return false;
}
if(document.sub.password.value == "")
{
alert("密码不能为空,请重新输入!");
document.sub.password.focus();
return false;
}
return true;
}
</script><BODY> <form method="POST" name="sub">
<P> <font size="3">用户名</font>:
<input type="text" name="logname" size="20"></P>
<P> <font size="3">密 码</font>:
<input type="password" name="password" size="20"></P></CENTER>
<P><font size="2">用户类型:
<input type="radio" name="usersort" value="admin" >管理员</font></P><P><font size="2">
<input type="radio" name="usersort" value="staff" >工作人员</font></P><P><font size="2">
<input type="radio" name="usersort" value="student" checked>考生</font></P>
<CENTER>
<P align="center"><font size="3"><font color="#0000FF"> 找回密码 </font>
<font color="#0000FF"> 新用户注册</font></font></P></center></TD></TR>
<TR>
<TD vAlign=top borderColor=#000000 width=625 height=48 align="center">
<input type="submit" value="提交" name="g" onclick="return FN_Check();">
<input type="reset" value="取消" name="B2">
</TD></TR>
</form>
</BODY></HTML>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:beibei";
Connection con=DriverManager.getConnection(url);
out.print("数据库连接成功,恭喜你");Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); String usersort = request.getParameter("usersort");
String logname = request.getParameter("logname");if(usersort!=null&&logname!=null)
{
String sql="select password from " + usersort + " where logname = '" + logname + "'";
out.print(sql);
ResultSet rs=stmt.executeQuery(sql);
if(rs.next())
{
response.sendRedirect("student.jsp");
}
else
{
out.print("密码错误");
}
rs.close();
}
stmt.close();
con.close();%>这次到成功了,但是为什么在我原来的页面里面就不行呢?代码是完全一样的阿。郁闷死我了:(
Login.jsp:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:beibei";
Connection con=DriverManager.getConnection(url);
out.print("数据库连接成功,恭喜你");Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); String usersort = request.getParameter("usersort");
String logname = request.getParameter("logname");if(usersort!=null&&logname!=null)
{
String sql="select password from " + usersort + " where logname = '" + logname + "'";
out.print(sql);
ResultSet rs=stmt.executeQuery(sql);
if(rs.next())
{
response.sendRedirect("student.jsp");
}
else
{
out.print("密码错误");
}
rs.close();
}
stmt.close();
con.close();%>
表单提交到LoginTemp.jsp页面表单提交改为
<form action="date.jsp" method="POST" name="sub">
__________________________________________________
既增加action方法。
表单提交到LoginTemp.jsp页面表单提交改为
<form action="LoginTemp.jsp" method="POST" name="sub">
__________________________________________________
既增加action方法