Hello friends i m trying to connect my jsp code with mysql front but i found myself helpless.
please guys help me.....this is the code.


<%@ page import="java.sql.*"%>
<%@ page import="javax.sql.*"%>
<%@ page import="java.util.Vector"%>
<%@ page import="java.io.*"%>
<%@ page language="java" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.text.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.util.Date"%>


<html>
<head>
<title>Congrats You Are now Part Of us</title>
</head>
<body>
<%
// get parameters from the request
String firstName = request.getParameter("FirstName");
String lastName = request.getParameter("LastName");
String emailAddress = request.getParameter("EmailiD");
%>
<h1>Thanks for joining our email list</h1>

<p>Here is the information that you entered:</p>
<%Connection con;
PreparedStatement stmt;
ResultSet rs;
String db="jdbc:mysql:///Email";
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(db,"root","123456");
stmt=con.prepareStatement("select * from Emailid");
rs=stmt.executeQuery();%>


<table cellspacing="5" cellpadding="5" border="1">
<tr>
<td align="right">First name:</td>
<td><%= firstName %></td>
</tr>
<tr>
<td align="right">Last name:</td>
<td><%= lastName %></td>
</tr>
<tr>
<td align="right">Email address:</td>
<td><%= emailAddress %></td>
</tr>
</table>
<p>To enter another email address, click on the Back <br>
button in your browser or the Return button shown <br>
below.</p>
<form action="join_email_list.html" method="post">
<input type="submit" value="Return">
</form>


</body>
</html>


thnks in advance.....:)

And what exactly would be the problem, other than the fact that this is JSP and should have been posted to the JSP Forum, and you are doing about every thing in a JSP that you shouldn't be.

sorry sir i don't get you what are trying to say

  • No Code tags
  • All JDBC Code is directly in the JSP
  • JSPs are only supposed to display data processed by the Java Beans where your database connectivity and processing should take place
  • This is a Core-JAVA forum, There already is a JSP forum in the web development section.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.