显示它不显示的空页';t重定向页面&;不使用jsp存储在数据库中

显示它不显示的空页';t重定向页面&;不使用jsp存储在数据库中,jsp,Jsp,这是我的JSP代码。当我单击save按钮时,它会显示一个空页面,并且不会在数据库中存储任何内容 pdes.jsp <jsp:include page="menu.jsp"></jsp:include> <%@page import="java.sql.*"%> <html> <head> <style> @import "compass/css3"; @i

这是我的JSP代码。当我单击save按钮时,它会显示一个空页面,并且不会在数据库中存储任何内容

pdes.jsp

   <jsp:include page="menu.jsp"></jsp:include>
     <%@page import="java.sql.*"%>
    <html>
    <head>
     <style>
         @import "compass/css3";

    @import "compass/css3";
     @import url(https://fonts.googleapis.com/css?
   family=Patua+One|Open+Sans);

    * { 
     -moz-box-sizing: border-box; 
      -webkit-box-sizing: border-box; 
    box-sizing: border-box; 
    }
      html, body {margin: 0; height: 100%; overflow: hidden}
      body {
    background:#353a40;
 }

   table {
   border-collapse: separate;
    background:#fff;
       @include border-radius(5px);
      margin:20px auto;
     @include box-shadow(0px 0px 5px rgba(0,0,0,0.3));
     }

            thead {
   @include border-radius(5px);
 }

  thead th {
     font-family: 'Patua One', cursive;
font-size:16px;
font-weight:400;
color:#fff;
@include text-shadow(1px 1px 0px rgba(0,0,0,0.5));
text-align:left;
  padding:20px;
 @include background-image(linear-gradient(#646f7f, #4a5564));
 border-top:1px solid #858d99;

 &:first-child {
 @include border-top-left-radius(5px); 
}

&:last-child {
  @include border-top-right-radius(5px); 
}
}

tbody tr td {
font-family: 'Open Sans', sans-serif;
font-weight:400;
color:#5f6062;
font-size:13px;
 padding:10px 10px 10px 10px;
 border-bottom:1px solid #e0e0e0;

 }

 tbody tr:nth-child(2n) {
  background:#f0f3f5;
 }

  tbody tr:last-child td {
    border-bottom:none;
 &:first-child {
    @include border-bottom-left-radius(5px);
 }
&:last-child {
  @include border-bottom-right-radius(5px);
}
 }

  tbody:hover > tr td {
  @include opacity(0.5);


 /* color:transparent;
  @include text-shadow(0px 0px 2px rgba(0,0,0,0.8));*/
 }

tbody:hover > tr:hover td {
      @include text-shadow(none);
    color:#2d2d2d;
  @include opacity(1.0);
  }

            .right {
text-align: right;
float: right;
   }input:focus {
   background-color: yellow;
   }
  body{

 color: #000;
  font: 100%/30px 'Helvetica Neue', helvetica, arial, sans-serif;
  text-shadow: 0 1px 0 #fff;
 }

        </style>    
    </head>
    <body>   <form method="POST" action="pdesad.jsp">
        <table><tr><td bgcolor='#c5eee7'>
                    <table  style="float:left;">
                         <%
              Connection conn = null;
  String url = "jdbc:mysql://localhost:3306/";
    String dbName = "login";
  String driver = "com.mysql.jdbc.Driver";
  String userName = "root";
  String password = "";

  Statement st;
               try {
    Class.forName(driver).newInstance();
    conn = DriverManager.getConnection(url + dbName, userName, password);

    String query1 = "select * from pdept";
    st = conn.createStatement();
    ResultSet rs = st.executeQuery(query1);
    %>

            <tr><th colspan="2"> <h1><center>Designation Details</h1></th>
  </tr>



            <tr><td>Department:</td><td> <select name="dept">
    <%
    while(rs.next())
    {
        %>
        <option><%=rs.getString(2)%></option>
        <%
    }

               }
               catch(Exception e)
               {
                   out.print(e);
               }
            %>
    </select></td></tr>
                   <tr><td>Designation:</td><td><input name="des" 
 type="text" required="required" ></td></tr>

        <tr><td> <input type="submit" value="Save"></td><td> <a 
class="right" href="Second" style="color: red;text-
decoration:none;">Close</a></td></tr><br>

        </table></td>

    </body>
  </html>
  <br>
<%

try {
    Class.forName(driver).newInstance();
    conn = DriverManager.getConnection(url + dbName, userName, password);

    String query = "select * from pdes";
    st = conn.createStatement();
    ResultSet rs = st.executeQuery(query);
    %>
    <td style="vertical-align:top;"> <div id="kryesore" style="overflow-y: 
scroll;height:250px;">
       <table border="1" style="float:right;" width="400">
           <tr><th bgcolor='#C0C0C0' colspan="3">Employee Designation 
Master</th></tr>
           <tr><th>Department</th><th>Designation</th>
</tr>
<%
    while (rs.next()) {
%>

  <tr><td><%=rs.getString("dept")%></td><td><%=rs.getString("des")%></td>
<td><a style="color:#ff00cc;text-decoration:none;" href="pdesedit.jsp?id=
 <%=rs.getString("id")%>">Edit</a></td><td><a style="color:#ff00cc;text-
decoration:none;" href="pdesdel.jsp?id=<%=rs.getString("id")%>">Delete</a>
</td></tr>

<%
    }
 %>
       </table></div></td></tr></table>   </form>
<%
}
    catch(Exception e)
            {
            out.println(e);
            }
 %> 
 <%@page import="java.sql.*,java.util.*"%>
 <%
 String dept=request.getParameter("dept");
String des=request.getParameter("des");

      try{
     Class.forName("com.mysql.jdbc.Driver");
       Connection con = 
 DriverManager.getConnection("jdbc:mysql://localhost:3306/login", "root", 
"");
       Statement st=con.createStatement();
       int i=st.executeUpdate("insert into pdes(dept,des) 
    values('"+dept+"','"+des+"')");
    response.sendRedirect("pdes.jsp");
    }
    catch(Exception e){
    System.out.print(e);
    e.printStackTrace();
    }
    %>

@输入“指南针/css3”;
@输入“指南针/css3”;
@导入url(https://fonts.googleapis.com/css?
家庭=帕图亚+一个|开放+SAN);
* { 
-moz框大小:边框框;
-webkit框大小:边框框;
框大小:边框框;
}
html,正文{边距:0;高度:100%;溢出:隐藏}
身体{
背景:353a40;
}
桌子{
边界塌陷:分离;
背景:#fff;
@包括边界半径(5px);
保证金:20px自动;
@包括盒子阴影(0px 0px 5px rgba(0,0,0,0.3));
}
泰德{
@包括边界半径(5px);
}
thead th{
字体系列:“八卦一号”,草书;
字体大小:16px;
字体大小:400;
颜色:#fff;
@包括文本阴影(1px 1px 0px rgba(0,0,0,0.5));
文本对齐:左对齐;
填充:20px;
@包括背景图像(线性梯度(#646f7f,#4a5564));
边框顶部:1px实心#858d99;
&:第一个孩子{
@包括边框左上半径(5px);
}
&:最后一个孩子{
@包括边框右上角半径(5px);
}
}
t车身变速器{
字体系列:“开放式Sans”,无衬线;
字体大小:400;
颜色:#5f6062;
字体大小:13px;
填充:10px 10px 10px 10px;
边框底部:1px实心#e0;
}
t车身tr:n第n个子(2n){
背景#f0f3f5;
}
tbody tr:最后一个孩子td{
边框底部:无;
&:第一个孩子{
@包括边框左下半径(5px);
}
&:最后一个孩子{
@包括边框右下半径(5px);
}
}
t车身:悬停>tr td{
@包括不透明度(0.5);
/*颜色:透明;
@包括文本阴影(0px 0px 2px rgba(0,0,0,0.8))*/
}
t车身:悬停>tr:悬停td{
@包括文本阴影(无);
颜色:#2d2d;
@包括不透明度(1.0);
}
.对{
文本对齐:右对齐;
浮动:对;
}输入:焦点{
背景颜色:黄色;
}
身体{
颜色:#000;
字体:100%/30px'Helvetica Neue',Helvetica,arial,无衬线;
文本阴影:0 1px 0#fff;
}
指定细节
部门:
任命:


员工指定 主人 部门名称
pdesad.jsp

   <jsp:include page="menu.jsp"></jsp:include>
     <%@page import="java.sql.*"%>
    <html>
    <head>
     <style>
         @import "compass/css3";

    @import "compass/css3";
     @import url(https://fonts.googleapis.com/css?
   family=Patua+One|Open+Sans);

    * { 
     -moz-box-sizing: border-box; 
      -webkit-box-sizing: border-box; 
    box-sizing: border-box; 
    }
      html, body {margin: 0; height: 100%; overflow: hidden}
      body {
    background:#353a40;
 }

   table {
   border-collapse: separate;
    background:#fff;
       @include border-radius(5px);
      margin:20px auto;
     @include box-shadow(0px 0px 5px rgba(0,0,0,0.3));
     }

            thead {
   @include border-radius(5px);
 }

  thead th {
     font-family: 'Patua One', cursive;
font-size:16px;
font-weight:400;
color:#fff;
@include text-shadow(1px 1px 0px rgba(0,0,0,0.5));
text-align:left;
  padding:20px;
 @include background-image(linear-gradient(#646f7f, #4a5564));
 border-top:1px solid #858d99;

 &:first-child {
 @include border-top-left-radius(5px); 
}

&:last-child {
  @include border-top-right-radius(5px); 
}
}

tbody tr td {
font-family: 'Open Sans', sans-serif;
font-weight:400;
color:#5f6062;
font-size:13px;
 padding:10px 10px 10px 10px;
 border-bottom:1px solid #e0e0e0;

 }

 tbody tr:nth-child(2n) {
  background:#f0f3f5;
 }

  tbody tr:last-child td {
    border-bottom:none;
 &:first-child {
    @include border-bottom-left-radius(5px);
 }
&:last-child {
  @include border-bottom-right-radius(5px);
}
 }

  tbody:hover > tr td {
  @include opacity(0.5);


 /* color:transparent;
  @include text-shadow(0px 0px 2px rgba(0,0,0,0.8));*/
 }

tbody:hover > tr:hover td {
      @include text-shadow(none);
    color:#2d2d2d;
  @include opacity(1.0);
  }

            .right {
text-align: right;
float: right;
   }input:focus {
   background-color: yellow;
   }
  body{

 color: #000;
  font: 100%/30px 'Helvetica Neue', helvetica, arial, sans-serif;
  text-shadow: 0 1px 0 #fff;
 }

        </style>    
    </head>
    <body>   <form method="POST" action="pdesad.jsp">
        <table><tr><td bgcolor='#c5eee7'>
                    <table  style="float:left;">
                         <%
              Connection conn = null;
  String url = "jdbc:mysql://localhost:3306/";
    String dbName = "login";
  String driver = "com.mysql.jdbc.Driver";
  String userName = "root";
  String password = "";

  Statement st;
               try {
    Class.forName(driver).newInstance();
    conn = DriverManager.getConnection(url + dbName, userName, password);

    String query1 = "select * from pdept";
    st = conn.createStatement();
    ResultSet rs = st.executeQuery(query1);
    %>

            <tr><th colspan="2"> <h1><center>Designation Details</h1></th>
  </tr>



            <tr><td>Department:</td><td> <select name="dept">
    <%
    while(rs.next())
    {
        %>
        <option><%=rs.getString(2)%></option>
        <%
    }

               }
               catch(Exception e)
               {
                   out.print(e);
               }
            %>
    </select></td></tr>
                   <tr><td>Designation:</td><td><input name="des" 
 type="text" required="required" ></td></tr>

        <tr><td> <input type="submit" value="Save"></td><td> <a 
class="right" href="Second" style="color: red;text-
decoration:none;">Close</a></td></tr><br>

        </table></td>

    </body>
  </html>
  <br>
<%

try {
    Class.forName(driver).newInstance();
    conn = DriverManager.getConnection(url + dbName, userName, password);

    String query = "select * from pdes";
    st = conn.createStatement();
    ResultSet rs = st.executeQuery(query);
    %>
    <td style="vertical-align:top;"> <div id="kryesore" style="overflow-y: 
scroll;height:250px;">
       <table border="1" style="float:right;" width="400">
           <tr><th bgcolor='#C0C0C0' colspan="3">Employee Designation 
Master</th></tr>
           <tr><th>Department</th><th>Designation</th>
</tr>
<%
    while (rs.next()) {
%>

  <tr><td><%=rs.getString("dept")%></td><td><%=rs.getString("des")%></td>
<td><a style="color:#ff00cc;text-decoration:none;" href="pdesedit.jsp?id=
 <%=rs.getString("id")%>">Edit</a></td><td><a style="color:#ff00cc;text-
decoration:none;" href="pdesdel.jsp?id=<%=rs.getString("id")%>">Delete</a>
</td></tr>

<%
    }
 %>
       </table></div></td></tr></table>   </form>
<%
}
    catch(Exception e)
            {
            out.println(e);
            }
 %> 
 <%@page import="java.sql.*,java.util.*"%>
 <%
 String dept=request.getParameter("dept");
String des=request.getParameter("des");

      try{
     Class.forName("com.mysql.jdbc.Driver");
       Connection con = 
 DriverManager.getConnection("jdbc:mysql://localhost:3306/login", "root", 
"");
       Statement st=con.createStatement();
       int i=st.executeUpdate("insert into pdes(dept,des) 
    values('"+dept+"','"+des+"')");
    response.sendRedirect("pdes.jsp");
    }
    catch(Exception e){
    System.out.print(e);
    e.printStackTrace();
    }
    %>


Java控制台在尝试加载CSS时显示404。它没有转到catch子句。

检查java控制台,如果有任何错误,请发布。是的…当我控制台我的pdes.jsp页面时..它显示错误消息为“css3未能加载资源:服务器以404(未找到)”的状态响应..我不知道它是什么..当我单击按钮时,它获取pdesad.jsp文件的值..但未到达insert query…@Vinoth KrishnanCheck是否正确导入了css3文件以及同一文件夹中的两个jsp文件。如果您可以在
pdesad.jsp
文件中获得
dept&des
的值,那么重定向就没有问题了。在连接代码中放置一个调试点,并检查异常发生的位置。它没有转到catchCheck您的java控制台并在出现任何错误时发布。是的…当我控制台我的pdes.jsp页面时。它显示错误消息为“css3未能加载资源:服务器以404(未找到)的状态响应”..我不知道它是什么..当我单击按钮时,它会得到pdesad.jsp文件的值..但它没有到达insert query…@Vinoth KrishnanCheck是否正确导入了css3文件以及同一文件夹中的两个jsp文件。如果您可以在
pdesad.jsp
文件中获得
dept&des
的值,那么重定向就没有问题了。在连接代码中放置一个调试点,并检查异常发生的位置。它没有进入捕获