嗨,我有一个页面可以控制电子邮件是否在使用中。但我有一个问题,它停留在“Kontrol ediliyor”(控制)位置。
它没有说“mail kullanımda”(邮件正在使用)或“mail boşta”(邮件为空),它只是说“kontrol ediliyor”。
我希望有一个解决方案。
索引.jsp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Mail Control From Db</title>
<script type="text/javascript" src="jquery-1.2.6.min.js"></script>
<script type="text/javascript" src="check.js"></script>
</head>
<body>
<div align="left">
<form name="chkForm" id="chkForm" method="post" >
<table>
<tr>
<td>Email</td>
<td>
<input type="text" name="email" id="email" size="20" ></td>
<td>
<div id="emailInfo" align="left"></div>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
检查.js
$(document).ready(function(){
var emailok = false;
var myForm = $("#chkForm"), email = $("#email"), emailInfo = $("#emailInfo");
//send ajax request to check email
email.blur(function(){
$.ajax({
type: "POST",
url: "check.jsp",
data: "email="+$(this).attr("value"),
dataType: "json",
beforeSend: function(){
emailInfo.html("<font color='blue'>Kontrol Ediliyor.. </font>");
},
success: function(data){
var checkData = data.toString();
if(checkData == "invalid")
{
emailok = false;
emailInfo.html("<font color='red'>Geçersiz mail.</font>");
}
else if(checkData == "0")
{
emailok = false;
emailInfo.html("<font color='red'>Mail kullanimda.</font>");
}
else if(checkData == "1")
{
emailok = true;
emailInfo.html("<font color='green'>Mail Bosta</font>");
}
}
});
});
});
检查.jsp
<%@page pageEncoding="ISO-8859-9"%>
<jsp:useBean id="checkMailBean" scope="page" class="checkMail">
</jsp:useBean>
<%
String rs="0";
rs = checkMailBean.dbConn("ousan@gmail.com");
if((rs == null) ||(rs.equals("0")))
{
//donusDeger="1";
out.println("1");
}//end if
else
{
//donusDeger="0";
out.println("0");
}
//String email = request.getParameter("email");
// Connection conn = null;
//Statement stmt03 =conn.createStatement();
//ResultSet rs03 = stmt03.executeQuery("select * from User where username="+email+");
//int recordCount = rs03.getRow();
//if(recordCount > 0)
//{
//out.println("0");
//}
//else
//{
//out.println("1");
//}
//stmt03.close();
//rs03.close();
%>
检查邮件.java
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import com.dasdas.oracle.pool.ConnectionPool;
import java.sql.ResultSet;
import java.sql.Statement;
import com.altar.oracle.pool.ConnectionPool;
public class checkMail
{
public String donusDeger;
public String strmail;
// database baglantisi
public String dbConn(String email)
{
Connection conn = null;
try
{
conn = ConnectionPool.getConnection();
System.out.println("database e baglaniliyor....");
Statement statement = conn.createStatement();
ResultSet resultset = statement.executeQuery("Select user_id from USER_LIST where user_email = "+email);
resultset.next();
String s = resultset.getString(1);
System.out.println(s);
statement.close();
conn.close();
return s;
}//end try
catch (Exception e)
{
e.printStackTrace();
System.out.println("Hata" + e);
return null;
} //end catch
}//end dbConn
}//end checkMail