Untitled
unknown
plain_text
a year ago
1.9 kB
5
Indexable
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <%@ page import="java.sql.*" %> <%@ page import="java.io.*" %> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body bgcolor="#ffffcc"> <font size="+3" color="green"><br>Welcome to Presidency University !</font> <FORM action="insert.jsp" method="get"> <TABLE style="background-color:#ECE5B6;" WIDTH="30%"> <TR> <TH width="50%">Employee No:</TH> <TD width="50%"><INPUT TYPE="text" NAME="eno"></TD> </TR> <TR> <TH width="50%">Employee Name:</TH> <TD width="50%"><INPUT TYPE="text" NAME="name"></TD> </TR> <TR> <TH width="50%">Employee Gender:</TH> <TD width="50%"><INPUT TYPE="text" NAME="gender"></TD> </TR> <TR> <TH width="50%">Employee Department:</TH> <TD width="50%"><INPUT TYPE="text" NAME="dept"></TD> </TR> <TR> <TH width="50%">Employee Salary:</TH> <TD width="50%"><INPUT TYPE="text" NAME="salary"></TD> </TR> <TR> <TH></TH> <TD width="50%"><INPUT TYPE="submit" VALUE="submit"></TD> </TR> </TABLE> <% int uq=0; try{ Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/employee1?characterEncoding=latin1","root","root"); PreparedStatement pstatement=con.preparedStatement("INSERT INTO EMPLOYEES1 VALUES(?,?,?,?,?)"); pstatement.setInt(1,Integer.valueOf(request.getParameter("eno"))); pstatement.setString(2,request.getParameter("name")); pstatement.setString(3,request.getParameter("gender")); pstatement.setString(4,request.getParameter("dept")); pstatement.setString(5,Integer.valueOf(request.getParameter("salary"))); uq=pstatement.executeUpdate(); pstatement.close(); con.close(); } catch(Exception ex){ } if (uq !=0){ %> <br> } %> </FORM> </body> </html>
Editor is loading...
Leave a Comment