"> " />
欢迎来到天天文库
浏览记录
ID:35200956
大小:27.74 KB
页数:16页
时间:2019-03-21
《javaweb动态表格》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、Javaweb动态表格制作一.信息登录(html)
2、ethod="post">
3、.sql.*;importjavax.servlet.ServletException;importjavax.servlet.http.*;publicclasstest1extendsHttpServlet{publicvoidservice(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{PrintWriterout=null;try{Class.forName("oracle.jdbc.driver.OracleDri
4、ver");Stringurl="jdbc:oracle:thin:@localhost:1522:orcl11gr2";Connectioncon=DriverManager.getConnection(url,"HR","oracle");Statementst=con.createStatement();request.setCharacterEncoding("utf-8");response.setContentType("text/html;charset=utf-8");out=response.getWriter();Stringname
5、=request.getParameter("name");doublesalary=Double.parseDouble(request.getParameter("salary"));intage=Integer.parseInt(request.getParameter("age"));ResultSetrs=st.executeQuery("insertintoworkersvalues('"+name+"',"+salary+","+age+")");response.sendRedirect("table");out.close();}cat
6、ch(Exceptione){e.printStackTrace();thrownewServletException();}finally{}}}三、动态表格(Javaservlet)importjava.io.IOException;importjava.io.PrintWriter;importjava.sql.*;importjavax.servlet.ServletException;importjavax.servlet.http.HttpServlet;importjavax.servlet.http.HttpServletRequest;
7、importjavax.servlet.http.HttpServletResponse;publicclasscdxextendsHttpServlet{publicvoidservice(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{PrintWriterout=null;try{request.setCharacterEncoding("utf-8");response.setContentType("text/htm
8、l;charset=utf-8");Class.forName("oracle.
此文档下载收益归作者所有