📄 chuangjianbugaction.java
字号:
package tmp;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.Action;
import gerenxinxi.gerenxinxi;
import javax.servlet.http.HttpSession;
import db.*;
import java.sql.Statement;
public class chuangjianbugAction extends Action {
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest servletRequest,
HttpServletResponse servletResponse)throws Exception {
chuangjianbugActionForm f = (chuangjianbugActionForm) actionForm;
//得到个人信息
HttpSession session = servletRequest.getSession();
gerenxinxi yonghu1 = (gerenxinxi) session.getAttribute("yonghu1");
//表单提交的
String banbenhao=f.getBanbenhao();
String bugBiaoti=f.getBugbiaoti();
String bugLeibieId=f.getBugleibie();
String bugMiaoshu=f.getBugmaoshu();
String caozuoxitongid=f.getCaozuoxitong();
String bugChulizheId=f.getKaifarenyuan();
String bugSuoshumokuaiId=f.getSuoshumokuai();
String bugYanzhongchengduId=f.getYouxianji();
String bugYujiezhishijian=f.getYujiezhiriqi();
//必添内容
String xiangmuid=yonghu1.getSuochuxiangmu().getXiangmuId();
String yonghuid=yonghu1.getBenrenxinxi().getYonghuId();
banbenhao= new String( banbenhao.getBytes("ISO-8859-1"), "gbk");
bugBiaoti= new String( bugBiaoti.getBytes("ISO-8859-1"), "gbk");
bugLeibieId= new String(bugLeibieId.getBytes("ISO-8859-1"), "gbk");
bugMiaoshu= new String(bugMiaoshu.getBytes("ISO-8859-1"), "gbk");
caozuoxitongid= new String(caozuoxitongid.getBytes("ISO-8859-1"), "gbk");
bugSuoshumokuaiId= new String(bugSuoshumokuaiId.getBytes("ISO-8859-1"), "gbk");
bugChulizheId= new String( bugChulizheId.getBytes("ISO-8859-1"), "gbk");
bugYanzhongchengduId= new String(bugYanzhongchengduId.getBytes("ISO-8859-1"), "gbk");
bugYujiezhishijian= new String(bugYujiezhishijian.getBytes("ISO-8859-1"), "gbk");
System.out.println(bugSuoshumokuaiId+" 111111111");
//传递的消息字符串
String xinxi="";
if(bugBiaoti.equals("")||bugChulizheId.equals(""))
{
xinxi="Bug创建失败,请输入完整信息!";
}
else
{
//连接数据库
Db db1 = new Db();
db1.getCon("bugBarrier");
//子连接字符串
String s1="insert into bug(bugChuangjianshijian ,bugZhuangtaiId,bugBiaoti,bugChuangjianzheId,bugSuoshuxiangmuId,bugChulizheId";
String s2=")values(getdate(),'1','"+bugBiaoti+"','"+yonghuid+"','"+xiangmuid+"','"+bugChulizheId+"'";
if (!banbenhao.equals("")) {
s1 = s1 + ",banbenhao";
s2 = s2 + ",'" + banbenhao + "' ";
}
if (!bugLeibieId.equals("")) {
s1 = s1 + ",bugLeibieId";
s2 = s2 + ",'" + bugLeibieId + "' ";
}
if (!bugMiaoshu.equals("")) {
s1 = s1 + ",bugMiaoshu";
s2 = s2 + ",'" + bugMiaoshu + "' ";
}
if (!caozuoxitongid.equals("")) {
s1 = s1 + ",caozuoxitongid";
s2 = s2 + ",'" + caozuoxitongid + "' ";
}
if (!bugSuoshumokuaiId.equals("")) {
s1 = s1 + ",bugSuoshumokuaiId";
s2 = s2 + ",'" + bugSuoshumokuaiId + "' ";
}
if (!bugYanzhongchengduId.equals("")) {
s1 = s1 + ",bugYanzhongchengduId";
s2 = s2 + ",'" + bugYanzhongchengduId + "' ";
}
if (!bugYujiezhishijian.equals("")) {
s1 = s1 + ",bugYujiezhishijian";
s2 = s2 + ",'" + bugYujiezhishijian + "' ";
}
//主连接字符串
String s=s1+s2+")";
Statement stmt = db1.conn.createStatement();
stmt.execute(s); //插入数据
db1.closeConnection();
xinxi = "新建Bug成功!";
}
servletRequest.setAttribute("xinxi",xinxi);
return actionMapping.findForward("tishixinxi");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -