0

Hello Dear,
Plz tell me how to create a bar chart fetch data from database using in jsp.
this is my connection code and plz tell me i add new code in same page or another page.

Thanks

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Customer Response</title>
    </head>
    <body>
                 <%@page import="java.sql.*" %>
        <%! String Name,date,Desg,Org,Add,Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8,Q9,Q10,Q11,Q12,Q13,Q14,Q15,Q16;
        Connection con=null;
        Statement Stmt=null;
    //    ResultSet rs=null;
        String drivername="com.mysql.jdbc.Driver";
        String url="jdbc:mysql://localhost:3306/wipro";
        String user="root";
        String password ="root";
        %>

<% 
Name= request.getParameter("Person");
date= request.getParameter("Date");
Desg=request.getParameter("Designation");
Org=request.getParameter("Organisation");
Add=request.getParameter("Address");
Q1=request.getParameter("group1");
Q2=request.getParameter("group2");
Q3=request.getParameter("group3");
Q4=request.getParameter("group4");
Q5=request.getParameter("group5");
Q6=request.getParameter("group6");
Q7=request.getParameter("group7");
Q8=request.getParameter("group8");
Q9=request.getParameter("group9");
Q10=request.getParameter("group10");
Q11=request.getParameter("group11");
Q12=request.getParameter("group12");
Q13=request.getParameter("group13");
Q14=request.getParameter("group14");
Q15=request.getParameter("group15");
Q16=request.getParameter("group16");
%>
        <%
        try{
            Class.forName(drivername);
           Connection con=DriverManager.getConnection(url,user,password);
             Statement Stmt = con.createStatement();
             Stmt.executeUpdate("insert into cust_entry(Name,Date,Desg,Org,Address) values('"+Name+"','"+date+"','"+Desg+"','"+Org+"','"+Add+"')");
             Stmt.executeUpdate("insert into cust_response(Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8,Q9,Q10,Q11,Q12,Q13,Q14,Q15,Q16) values('"+Q1+"','"+Q2+"','"+Q3+"','"+Q4+"','"+Q5+"','"+Q6+"','"+Q7+"','"+Q8+"','"+Q9+"','"+Q10+"','"+Q11+"','"+Q12+"','"+Q13+"','"+Q14+"','"+Q15+"','"+Q16+"')");
        }catch(SQLException  e)
        {
            System.out.println(e);
        }

        %>

Name :<%=Name%>
<br>
Date:<%=date%>
<br>
Desg:<%=Desg%>
<br>
Org:<%=Org%>
<br>
Add:<%=Add%>
<br>
group1:<%=Q1%>
<br>
group2:<%=Q2%>
<br>
group3:<%=Q3%>
<br>
group4:<%=Q4%>
<br>
group5:<%=Q5%>
<br>
group6:<%=Q6%>
<br>
group7:<%=Q7%>
<br>
group8:<%=Q8%>
<br>
group9:<%=Q9%>
<br>
group10:<%=Q10%>
<br>
group11:<%=Q11%>
<br>
group12:<%=Q12%>
<br>
group13:<%=Q13%>
<br>
group14:<%=Q14%>
<br>
group15:<%=Q15%>
<br>
group16:<%=Q16%>


    </body>
</html>
2
Contributors
1
Reply
5
Views
2 Years
Discussion Span
Last Post by janissantony
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.