0
如何使用jquery從jsp檢索數據? 我創建了一個基本表單,並將值存儲到mysql數據庫中。然後使用jsp.Now檢索數據庫值,我希望我的jquery從jsp代碼獲取這些值並打印這些值。 這是我的jsp使用jquery檢索數據
<%
String vlemail=request.getParameter("vlemail");
try
{
String str="jdbc:mysql://localhost:3306/licet";
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con=null;
con=DriverManager.getConnection(str,"root","");
Statement st=con.createStatement();
ResultSet rs =st.executeQuery("select Password from record where Email='"+vlemail+"'");
while(rs.next())
{
String a=rs.getString("Password");
}
out.println("Retrieved");
}
catch(Exception e)
{
out.println(e);
out.println("Not retrieved");
}
%>
代碼,這是我的html代碼
<body style="background-color:#663366">
<div class="container">
<br />
<div class="jumbotron">
<h1>Authentica</h1>
<p>Have an account already? Then login</p>
</div>
<form class="form-horizontal" action="newjsp.jsp" method="GET">
<div class="form-group">
<label class="control-label col-sm-2" for="email" style="color:#FFFFFF">Email:</label>
<div class="col-sm-3">
<input type="email" class="form-control" name="vlemail" id="lemail" placeholder="Enter email" />
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="submit" class="btn btn-default" value="Next" />
</div>
</div>
</form>
</center>
</div>
</body>
現在,我想我的jQuery從JSP獲取數據並打印