📄 add_unit_save.jsp
字号:
<%@ page errorPage="err.jsp" %>
<%@ page contentType="text/html;charset=gb2312"%>
<%
if (session.getAttribute("admin")==null || session.getAttribute("admin")==""
|| session.getAttribute("scope")==null || !session.getAttribute("scope").equals("input_y"))
{
//response.sendRedirect("index.jsp");
out.println("<script language=javascript>window.top.location.href='index.jsp'</script>");
}
%>
<%@ page language="java" import="java.sql.*"%>
<jsp:useBean id="sqlbean" scope="page" class="qqhr.sql_data"/>
<jsp:useBean id="transcode" scope="page" class="qqhr.TransFormat"/>
<%
String year = null;
year = request.getParameter("year");
%>
<%
String sql = null;
ResultSet rs = null;
String kind = null;
int first_id = 0,second_id = 0, type = 0;
String action;
action = request.getParameter("action");
String bm = null;
bm =request.getParameter("bm"); //单位编码
String first = null;
first = transcode.GB2unicode(request.getParameter("first"));//一级单位
sql = "select * from y031 where dw='"+first+"' and nian_fen='"+year+"'";
rs = sqlbean.executeQuery(sql);
if(rs.next())
{
kind = rs.getString("kind");
first_id = rs.getInt("id");
type = rs.getInt("type");
}
String second = null;
second = transcode.GB2unicode(request.getParameter("second"));//二级单位
sql = "select * from y031 where dw='"+second+"' and nian_fen='"+year+"'";
rs = sqlbean.executeQuery(sql);
if(rs.next())
{
kind = rs.getString("kind");
second_id = rs.getInt("id");
type = rs.getInt("type");
//out.println("the second id is:"+second_id);//test!!
}
String third = null;
third = transcode.GB2unicode(request.getParameter("third"));//三级单位
//out.println("the third dw is:"+third);//test!!
if(action!=null && action!="")
{
if(action.equals("save"))
{
if((third != null) && (third != "")) //此时添加的是三级单位!
{
for(int i = 1;i <= 1;i++)
{
sql="INSERT INTO y031 (bm,dw,parent,kind,type,nian_fen) Values ('"+bm+"','"+third+"',"+second_id+",'"+kind+"',"+type+",'"+year+"')";
int n=sqlbean.executeInsert(sql);
if(n<0)out.println(sqlbean.executeError("insert"));
sqlbean.closeConn();
out.println("<script language=javascript> alert('单位信息已成功添加!');window.parent.main.location.href='y03.jsp?year="+year+"';</script>");
}
}//end if
else//此时添加的是二级单位!
{
for(int i = 1;i <= 1;i++)
{
sql="INSERT INTO y031 (bm,dw,parent,kind,type,nian_fen) Values ('"+bm+"','"+second+"',"+first_id+",'"+kind+"',"+type+",'"+year+"')";
int n=sqlbean.executeInsert(sql);
if(n<0)out.println(sqlbean.executeError("insert"));
sqlbean.closeConn();
out.println("<script language=javascript> alert('单位信息已成功添加!');window.parent.main.location.href='y03.jsp?year="+year+"';</script>");
}
}//end else
}//end if
}//end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -