日期:2014-05-17  浏览次数:21047 次

表单填写后的页面无法连接数据库
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%
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>注册页面</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 language="javascript">
 function mycheck(){
 if (form1.UserName.value=="")
 {alert("请输入用户名!");form1.UserName.focus();return;}
 if(form1.PWD.value=="")
 {alert("请输入密码!");form1.PWD.focus();return;}

 form1.submit();
 }
</script>




  </head>
  
  <body>
  
  <form name="form1" method="POST" action="MyJsp.jsp"><!-- 提交的action根据struts-config.xml文件对应method后为FindUserAction的方法名 -->
<table width="364" height="145" border="0" align="center"
cellpadding="0" cellspacing="0">
<tr>
<td height="2" colspan="2"></td>
</tr>

  <tr>
<td height="2" colspan="2" valign="top"></td>
</tr>
<tr>

<td width="54" height="22" valign="bottom">
<span class="STYLE15" >用户名:</span>
</td>
<td width="310" valign="bottom">
<input name="UserName" type="text" class="input2" onKeyDown="if(event.keyCode==13){form1.PWD.focus();}"
onMouseOver="this.style.background='#F0DAF3';"
onMouseOut="this.style.background='#FFFFFF'"><!-- 设置用户名文本框,并设置了鼠标经过是样式 -->
</td>
</tr>
<tr>
<td height="23" colspan="2" valign="bottom"></td>
</tr>
<tr>
<td height="34" colspan="2" valign="top" class="STYLE15">
密&nbsp;&nbsp;码:
<input name="PWD" type="password" class="input2" align="bottom"
onKeyDown="if(event.keyCode==13){form1.yanzheng.focus();}"
onMouseOver="this.style.background='#F0DAF3';"
onMouseOut="this.style.background='#FFFFFF'"><!-- 设置密码文本框 -->
</td>
</tr>

<tr>
<td colspan="2" valign="top">&nbsp; &nbsp; &nbsp; &nbsp;
<input name="Submit" type="button" class="submit1" value="注册" onClick="mycheck()"> &nbsp;
<input name="Submit2" type="reset" class="submit1&