Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Servlet/JSP/JSF/JavaFX Script » 精华  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to postflat modethreaded modego to previous topicgo to next topicgo to back
作者 请高手看看(编译不过啊 总说我的语句非法!)
c00lzhang





发贴: 20
于 2005-11-14 16:26 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
package xx;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
import java.io.*;

public class Xieru
extends HttpServlet
  {
public Xieru()
    {
}

String ID, Name, Sex, Age, bumen, url, sql;
public void setID(String ID)
    {
this.ID = ID;
}

public String getID()
    {
return ID;
}

public void setName(String Name)
    {
this.Name = Name;
}

public String getName()
    {
return Name;
}

public void setSex(String Sex)
    {
this.Sex = Sex;
}

public String getSex()
    {
return Sex;
}

public void setAge(String Age)
    {
this.Age = Age;
}

public String getAge()
    {
return Age;
}

public void setbumen(String bumen)
    {
this.bumen = bumen;
}

public String getbumen()
    {
return bumen;
}

public void XIE()
    {
public void doPost(HttpServletRequest request,HttpServletResponse response)
try
      {
       response.setContentType("tet/html;charset=gb2312");
   PrintWriter out=response.getWriter();
   request.setCharacterEncoding("gb2312");
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
url ="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=gongsi";
conn = DriverManager.getConnection(url, "sa", "1017");
stmt = conn.createStatement();
sql = "select * from renyuan where ID='" + ID + "'";
rs = stmt.executeQuery(sql);

sql = "insert into renyuan(ID,Name,Sex,Age,bumen)";
sql = sql + "values('" + ID + "','" + Name + "','" + Sex + "','" +
Age + "','" + bumen + "')";
stmt.executeUpdate(sql);
PrintWriter pw = response.getWriter();
pw.print("<font size=3 color=bule>ϵͳÕýÔÚ¸üУ¬ÇëÉÔºó......</font><meta http-equiv-'refresh' content='2;url=list.jsp'>");
pw.close();


rs.close();
stmt.close();
conn.close();
}
catch (Exception e)
      {
System.out.println(e.toString());
      }
}
}




Hibernate的优点

话题树型展开
人气 标题 作者 字数 发贴时间
4914 请高手看看(编译不过啊 总说我的语句非法!) c00lzhang 2542 2005-11-14 16:26
3759 Re:请高手看看(编译不过啊 总说我的语句非法!) YuLimin 27 2005-11-16 11:22
3830 Re:请高手看看(编译不过啊 总说我的语句非法!) chengbd 28 2005-11-16 17:04
4149 Re:请高手看看(编译不过啊 总说我的语句非法!) ntshenwh 109 2005-11-16 18:21

reply to postflat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923