该源码为JSP的开发案例集锦

源代码在线查看: add.jsp

软件大小: 6034 K
上传用户: sheng_xia
关键词: JSP 源码 案例 集锦
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				
				
				
				
				保存留言
				
				
				
				
								    String name=request.getParameter("name");
				    name=new String(name.getBytes("8859_1"));
					String title=request.getParameter("title");
				    title=new String(title.getBytes("8859_1"));
					String content=request.getParameter("content");
				    content=new String(content.getBytes("8859_1"));
					String mail=request.getParameter("mail");
				    mail=new String(mail.getBytes("8859_1"));
					
				    Class.forName("org.gjt.mm.mysql.Driver");
				    String dbUrl = "jdbc:mysql://localhost/csnews";
				 	String dbUser = "root";
				 	String dbPassword = "";
				    Connection	con = DriverManager.getConnection(dbUrl,dbUser,dbPassword); 
				    Statement    stm=con.createStatement();
				    String sql="insert into message values('"+title+"','"+name+"','"+content+"','"+
							mail+"','" + new java.util.Date() + "')";
					if(stm.executeUpdate(sql)==1)
						     
					 else
				           out.print("添加失败");
				      con.close();
				%>
				
				
							

相关资源