jsp 提交 数据库

wenwen1 发布于 2012/09/10 10:23
阅读 132
收藏 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 Project_ID= request.getParameter("Project_ID");
  int aid = Integer.parseInt(Project_ID);
  String Application_ID = request.getParameter("Application_ID");
  int id = Integer.parseInt(Application_ID);
  String Ext_Name = request.getParameter("Ext_Name");
  String Project_Requirement = request.getParameter("Project_Requirement");
  String Source_From = request.getParameter("Source_From");
  String xmyjwcsj = request.getParameter("xmyjwcsj");
  String pzwcsj = request.getParameter("pzwcsj");
  String sfwdhy = request.getParameter("sfwdhy");
  String User_ID = request.getParameter("User_ID");
  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");
  int aidw= Integer.parseInt(idw);
  String role = request.getParameter("Role_ID");
  int Role_ID = Integer.parseInt(role);
  String sql = "insert into project_artical(Source_From,Project_ID,Application_ID,Project_Attribute,Ext_Name,Project_Requirement,Setup_Date,xmyjwcsj,pzwcsj,sfwdhy,post_code,Desicion_Line,Project_Budget,User_ID) values ('"+Source_From+"','"+aid+"','"+id+"','"+Project_Attribute+"','"+Ext_Name+"','"+Project_Requirement+"','"+datetimenow+"','"+xmyjwcsj+"','"+pzwcsj+"','"+sfwdhy+"','"+post_code+"','"+Desicion_Line+"','"+Project_Budget+"','"+User_ID+"')";
  String sql2 = "insert into project_user(User_ID,Role_ID,Project_ID) values ('"+aidw+"','"+Role_ID+"','"+aid+"')";
  boolean bol = dbConn.Sql(sql);
  boolean bol2 = dbConn.Sql(sql2);
  if(bol&bol2){
       out.println("添加成功!");
   }else{
       out.println("出错了,请重新操作!");
   }
  dbConn.releaseConn();//释放链接
  response.setHeader("Refresh","1; URL=MyJsp.jsp");//12秒后自动跳转页面

  %>   
  </body>
</html>
请问红色的代码这样写可以吗?
加载中
0
leo108
leo108
应该是&&吧
0
情天大圣
情天大圣
最好还是像楼上那种正确的逻辑与(逻辑运算):boolean && boolean,而不是位与(位运算)。
wenwen1
wenwen1
哦,好的,谢谢啦
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部