向自己的页面提交

<%@ page contentType="text/html; charset=gb2312" language="java" %>
<%@ page import="com.sgai.suvery.model.SuverySubject" %>
<%@ page import="com.sgai.suvery.dao.SuverySubjectDao" %>
<%@ page import="com.sgai.framework.sql.DbOperator" %>
<%@ include file="../permission/permission.jsp" %>
<%@ include file="../permission/permission_ survey.jsp" %>
<html>
<script type="text/javascript">
</script>
<head>
    <link rel="stylesheet" href="../css/Admin_STYLE.CSS">
    <link rel="stylesheet" href="../css/style2.css">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <style type="text/css">
        <!--
        .style3 {
            color: #FFFFFF;
            font-weight: bold;
        }

        -->
    </style>
</head>
<%
    String leibie = request.getParameter("leibie");    
    if(leibie == null){
%>
<form action="editstate.jsp">
    <input type="hidden" name="leibie" value="1">
    <body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
    <table cellpadding="2" cellspacing="1" border="0" width="100%" class="border" align=center>
        <tr align="right">
            <td height=25 class="topbg">
                <table cellpadding="0" cellspacing="0" border="0" width="100%" align=center>
                    <tr>
                        <td align="right">
                            <div align="center" class="style3">修 改 发 布 状 态</div>
                            <div align="center"></div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <%
        String myid = request.getParameter("id");
        String Tflag = "0";
        String Ts_type = "0";
        SuverySubjectDao SuverysubjectDaoobj = new SuverySubjectDao();
        if (myid != null) {
            SuverySubject SuverySubjectobj = SuverysubjectDaoobj.loadByID(myid);            
            Tflag = SuverySubjectobj.getFlag();
        }
    %>
    <table width="100%" border="0" cellpadding="0" cellspacing="1" class="border">
        <tr class="tdbg">
            <td align="right">是否发布</td>
            <td><select name="flag">
                <option  <%if (Tflag != null && Tflag.equals("0")) {%> selected<%}%> value="0">未发布</option>
                <option  <%if (Tflag != null && Tflag.equals("1")) {%> selected<%}%> value="1">发布</option>
            </select></td>
        </tr>
        <tr class="tdbg">
    </table>
    <table width="100%" border="0" align="center">
        <td colspan="2" align="center">
            <tr class="tdbg" align="center">
                <input type="hidden" name="flag">
                <input type="hidden" name="myid" value="<%=myid%>">
                <input name="button" type="Submit" class="buttona" value="确定">
            </tr>
        </td>
    </table>
    </body>
</form>
<%
    }
    else {
        String myid = request.getParameter("myid");
        String flag = request.getParameter("flag");
        boolean Uflag = false;
        String updatesql = "update INNE_SUVERY_SUBJECT set flag=" + flag + "where id=" + myid;
        if (myid != null && flag != null) {
            DbOperator.executeUpdate(updatesql);
            Uflag = true;
        }
        if (Uflag == true) {
            out.println("<script language='javascript'>alert('修改成功!');self.opener.location.reload();window.close();</script>");
        } else {
            out.println("<script language='javascript'>alert('修改失败!');window.opener = null;window.close();</script>");
        }
    }
%>
</html>
 

posted @ 2007-05-22 12:22  hibernate3例子  阅读(78)  评论(0编辑  收藏  举报