jsp 提交 要将获取先前提交的数据的ID插入到另一个表中的Project_ID

wenwen1 发布于 2012/09/24 20:27
阅读 478
收藏 0
<%@ page language="java" import="java.util.*" import="java.sql.*" pageEncoding="utf-8"%>
<jsp:useBean id="dbConn" class="pack_convert.DBConnXmgl"/>
<jsp:useBean id="systemRelated" class="net.gvsun.database.SystemRelated"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   
    <title>proApplicationSub</title>

  </head>
 
  <body>
  <%
  request.setCharacterEncoding("utf-8");//处理乱码
  String Project_Attribute = request.getParameter("Project_Attribute");
  String hdlx = request.getParameter("Activity_Type");
  String Source_From = request.getParameter("Source_From");
  String End_Date = request.getParameter("End_Date");
  String User= request.getParameter("User_Name");
  String Project_Requirement = request.getParameter("Project_Requirement");
  String Project_Level = request.getParameter("Project_Level");
  String post_code = request.getParameter("post_code");
  String Desicion_Line = request.getParameter("Desicion_Line");
  String Project_Budget = request.getParameter("Project_Budget");
  String datetimenow = systemRelated.getDateTimeNow();
  String idw = request.getParameter("User_ID");
  int aidw= Integer.parseInt(idw);
  String role = request.getParameter("Role_ID");
  int Role_ID = Integer.parseInt(role);
  String Project_NAME = request.getParameter("Project_NAME");
  String Specification = request.getParameter("Specification");
  String sql = "insert into project(Project_NAME,Setup_DATE,Setup_BY,Specification) values ('"+Project_NAME+"','"+datetimenow+"','admin','"+Specification+"')";
  boolean bol = dbConn.Sql(sql);
  if(bol){
      String sql1 = "select project.ID from project where project.Project_NAME='"+Project_NAME+"'";
      ResultSet rs = dbConn.doQuery(sql1);
      if(rs.next()){
          String sql2 = "insert into project_artical(Source_From, Project_ID,Project_Attribute,Project_Requirement,Setup_Date,End_Date,Project_Level,post_code,Desicion_Line,Project_Budget,User_ID,Project_Name,Activity_Type) values ('"+Source_From+"','"+ project.ID+"','"+Project_Attribute+"','"+Project_Requirement+"','"+datetimenow+"','"+End_Date+"','"+Project_Level+"','"+post_code+"','"+Desicion_Line+"','"+Project_Budget+"','"+User+"','"+Project_NAME+"','"+hdlx+"')";
          String sql3 = "insert into project_user(User_ID,Role_ID,Project_ID) values ('"+ project.ID+"','"+Role_ID+"','"+aid+"')";
          }
  }else{
       out.println("出错了,请重新操作!");
  }
  dbConn.releaseConn();//释放链接
  response.setHeader("Refresh","1; URL=appPeople.jsp");//12秒后自动跳转页面

  %>   
  </body>

</html>

怎么写啊?


加载中
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部