⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 registinput.java

📁 blood bank system to handale
💻 JAVA
字号:
		/*HELPLINESERVLET REGISTRATION FORM&INSERTING DATA*/


import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class registinput  extends HttpServlet
{
	public void doPost(HttpServletRequest req,HttpServletResponse res)throws IOException,ServletException
	{
		PreparedStatement ps;
		Connection con3;
		String str1,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11,str12,str13,str14;
		try
		{
		
			res.setContentType("text/html");
			PrintWriter out=res.getWriter();
			 str1=req.getParameter("name");
			 str2=req.getParameter("addr");
			 str3=req.getParameter("city");
			str4=req.getParameter("state");
			str5=req.getParameter("email");
			
			str6=req.getParameter("org");
			str7=req.getParameter("age");
			str8=req.getParameter("pg");
			str9 =req.getParameter("weight");
			str10=req.getParameter("bg");
			str11=req.getParameter("fdoc");
			
			str12=req.getParameter("phoneo");
			str13=req.getParameter("phoner");
			
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			con3=DriverManager.getConnection("jdbc:odbc:chand","scott","tiger");
			System.out.println( "database connected");	
			ps = con3.prepareStatement("Insert into don values(?,?,?,?,?,?,?,?,?,?,?,?,?)");
			ps.setString(1,str1);
			ps.setString(2,str2);
			ps.setString(3,str3);
			ps.setString(4,str4);
			ps.setString(5,str5);
			ps.setString(6,str6);
			ps.setInt(7,Integer.parseInt(str7));
			ps.setString(8,str8);
			ps.setInt(9,Integer.parseInt(str9));
			ps.setString(10,str10);
			ps.setString(11,str11);
			ps.setString(12,str12);
			ps.setString(13,str13);
			ps.executeUpdate();
			System.out.println("rows inserted");
			System.out.println("<html>");
			System.out.println("<body bgcolor='cyan'>");
			System.out.println("<h1>Thank You For Registration!</h1>");
			System.out.println("<table align='center'>");
			System.out.println("<tr>");
			System.out.println("<td>");
			System.out.println("<a href=d:/project1/bloodmain.htm>Home |</a>");
			System.out.println("</td>");
			System.out.println("<td>");
			System.out.println("<a href=d:/project1/Aboutus.htm>About Us |</a>");
			System.out.println("</td>");
			System.out.println("<td>");
			System.out.println("<a href=d:/project1/Regist.htm>How Do I Donate |</a>");
			System.out.println("</td>");
			System.out.println("<td>");
			System.out.println("<a href="mailto:shashi2000@rediff.com">E_mail us</a>");
			System.out.println("</td>");
			System.out.println("</tr>");
			System.out.println("</table>");
			System.out.println("</body>");
			System.out.println("</html>");
			con3.close();
		}	
		catch(SQLException ee)
		{	
			ee.printStackTrace();
		}

		catch(ClassNotFoundException e)
		{	
			e.printStackTrace();				
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -