hey... i have a problem..I am working on a problem management system..my code for a particular jsp page is as follows in this page i want to show the admin the already present records in the table named problem..and a submit solution button besides every row..whenever the admin clicks on the submit button that particular row should be deleted from this table and stored in another table named solution along with the solution which the admin has to enter.
print("code sample");
<table width="205%" border="0"> <tr > <td width="105%" bgcolor="#FFFFFF"><table width="100%" height="100" border="1"> <tr> <th width="5%" scope="row">EMPLOYEE NUMBER</th> <td width="5%">EMPLOYEE NAME</td> <td width="3%">MODULE NAME</td> <td width="4%">PHONE NUMBER</td> <td width="6%">EMAIL</td> <td width="8%">PROBLEM DESCRIPTION</td> <td width="5%">PROBLEM DATE</td> <td width="5%">PROBLEM ID</td> <td width="5%">SOLUTION</td> </tr> <% String login_name=(String)request.getAttribute("login"); `String cmd; System.out.println(login_name); if(login_name.equals("mehak")) { cmd="select * from problem where area='Hospitality'"; } else if(login_name.equals("nipun")) { cmd="select * from problem where area='Gate Pass'"; } else { cmd="select * from problem where area='Document Tracker'"; } PreparedStatement psmt=con.prepareStatement(cmd); ResultSet rs=psmt.executeQuery(); while(rs.next()) { %> <tr> <th width="5%" scope="row"><%=rs.getString(1) %></th> <td width="5%"><%=rs.getString(2) %></td> <td width="3%"><%=rs.getString(4) %></td> <td width="4%"><%=rs.getString(5) %></td> <td width="4%"><%=rs.getString(6) %></td> <td width="6%"><%=rs.getString(7) %></td> <td width="8%"><%=rs.getString(8) %></td> <td width="5%"><%=rs.getInt(9) %></td> <% System.out.println(rs.getRow());%> <td width="5%"> <form id="submit1" name="submit1" method="post" action="solution.jsp"> <select name="resolve"> <option value=<%rs.getRow(); %>>resolve</option> </select> <input type="submit" name="submit" id="resolve" value="submit"/> </form> </td> </tr> <% } %> </table></td> </tr> </table>
THE above code is like this .. <th width="5%" scope="row">EMPLOYEE NUMBER</th> <td width="5%">EMPLOYEE NAME</td> <td width="3%">MODULE NAME</td> <td width="4%">PHONE NUMBER</td> <td width="6%">EMAIL</td> <td width="8%">PROBLEM DESCRIPTION</td> <td width="5%">PROBLEM DATE</td> <td width="5%">PROBLEM ID</td> <td width="5%">SOLUTION</td> </tr> <% String login_name=(String)request.getAttribute("login"); String cmd; System.out.println(login_name); if(login_name.equals("mehak")) { cmd="select * from problem where area='Hospitality'"; } else if(login_name.equals("nipun")) { cmd="select * from problem where area='Gate Pass'"; } else { cmd="select * from problem where area='Document Tracker'"; } PreparedStatement psmt=con.prepareStatement(cmd); ResultSet rs=psmt.executeQuery(); while(rs.next()) { %> <tr> <th width="5%" scope="row"><%=rs.getString(1) %></th> <td width="5%"><%=rs.getString(2) %></td> <td width="3%"><%=rs.getString(4) %></td> <td width="4%"><%=rs.getString(5) %></td> <td width="4%"><%=rs.getString(6) %></td> <td width="6%"><%=rs.getString(7) %></td> <td width="8%"><%=rs.getString(8) %></td> <td width="5%"><%=rs.getInt(9) %></td> <% System.out.println(rs.getRow());%> <td width="5%"> <form id="submit1" name="submit1" method="post" action="solution.jsp"> <select name="resolve"> <option value=<%rs.getRow(); %>>resolve</option> </select> <input type="submit" name="submit" id="resolve" value="submit"/> </form> </td> </tr> <% } %> </table></td> </tr> </table> <table width="2122" height="104" border="0"> <tr> <th width="24%" height="100" scope="row"> </th> <td width="76%" bgcolor="black"><div align="center"> <table width="70%" border="0"> <tr> <th scope="row"><a href="adminproblem.jsp">PROBLEM</a></th> <td><p align="center"><a href="adminsolution.jsp">SOLUTION</a></p></td> <td><div align="center"><a href="adminsuggestion.jsp">SUGGESTION</a></div></td> </tr> </table> <table width="40%" border="0"> <tr> <th class="copyright" scope="row">Copyright @ GAIL(INDIA) LIMITED.All right reserved.</th> </tr> </table> </div></td> <td width="0%"> </td> </tr> </table> </body> </html>
Ads