<html>  
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
         
</head>
<body bgcolor="white">
   <jsp:include page="menu.jsp"></jsp:include>
    <h2><font face=white></font></h2>
   
  
 
<%@page language="java" import="java.util.*,java.sql.* " contentType="text/html"%>

<%             // String a= request.getParameter("QosType");
               // String b= request.getParameter("op");


                int s1=Integer.parseInt(request.getParameter("QosType"));
                int s2=Integer.parseInt(request.getParameter("op"));
                //int sec=Integer.parseInt(request.getParameter("sec"));
                String section=request.getParameter("sec");
                //out.print(sec);
               
                
		
           try {  
            
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           
            Connection con=DriverManager.getConnection("jdbc:odbc:sree","sree","sree");

           
            if(s1==1 && s2==1)
               { 
                if(section.equals("all"))
                {    
                PreparedStatement pstmt = con.prepareStatement("select * from mqb order by qid");
                    
                ResultSet rs= pstmt.executeQuery();
                out.println("<h2><center>Multiple Choice Questions</center></h2>");
                
                 while(rs.next())
                 {
                  
                 out.println("<table>");
                 out.println("<tr><th style=text-align:center; font-family:Comic Sans MS; font-size:20px; color:images\bg.jpg;>"+rs.getInt(1)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</th>");
                 out.println("<th align=left>"+rs.getString(8)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</th>");
                 out.println("<th align=left>"+rs.getString(2)+"</th></tr>");
                 
                 out.println("</table></h2>");
                 
                 out.println("<table>");
                 out.println("<tr><td></td><td>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp1)&nbsp&nbsp "+rs.getString(4)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 2) &nbsp&nbsp "+rs.getString(5)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 3) &nbsp&nbsp "+rs.getString(6)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 4)&nbsp&nbsp "+rs.getString(7)+"</td></tr>");
                 out.println("<tr><td>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td><td align=left>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ans: &nbsp "+rs.getString(3)+"</td></tr>");
                 out.println("</table><br>");
                 
                 }  
              
                  out.println("<br><br><br>");
                 }
                 else
                 {    
                PreparedStatement pstmt = con.prepareStatement("select * from mqb where sec='"+section+"' order by qid");
                    
                ResultSet rs= pstmt.executeQuery();
                out.println("<h2><center>Multiple Choice Questions</center></h2>");
                 out.print("<h2><center>"+section+"</center></h2>");
                 int a=1;
                 while(rs.next())
                 {
                  
                 out.println("<table>");
                 out.println("<tr><th style=text-align:center; font-family:Comic Sans MS; font-size:20px; color:green;>"+a+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</th>");
                 
                 out.println("<th align=left>"+rs.getString(2)+"</th></tr>");
                 
                 out.println("</table></h2>");
                 
                 out.println("<table>");
                 out.println("<tr><td>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp  1)&nbsp&nbsp "+rs.getString(4)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 2) &nbsp&nbsp "+rs.getString(5)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 3) &nbsp&nbsp "+rs.getString(6)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 4)&nbsp&nbsp "+rs.getString(7)+"</td></tr>");
                 out.println("<tr><td align=left>&nbsp&nbsp&nbsp ans: &nbsp "+rs.getString(3)+"</td></tr>");
                 out.println("</table><br>");
                 a++;
                 }  
              
                  
                 }                                             
             }
            
             else if(s1==1 && s2==2)
            {
               
               RequestDispatcher rd=request.getRequestDispatcher("minsert.jsp");
               rd.forward(request,response);
               
                
            }
            
            else if(s1==1 && s2==3)
            {
               
                RequestDispatcher rd=request.getRequestDispatcher("mdelete.jsp");
                rd.forward(request,response);
               
                
                
            }
            else if(s1==1 && s2==4)
                {
                 RequestDispatcher rd=request.getRequestDispatcher("medit.jsp");
                rd.forward(request,response);
                }
            
            
            else if(s1==2 && s2==1 )
            {
               if(section.equals("all")) 
               {   
                PreparedStatement pstmt = con.prepareStatement("select * from fqb order by qid");
                    
                ResultSet rs= pstmt.executeQuery();
                 out.println("<h2><center>Fill in the Blanks</center></h2>");
                while(rs.next())
                {
                 
                 out.println("<table>");
                 out.println("<tr><td align=center>"+rs.getInt(1)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>");
                 out.println("<td align=left>"+rs.getString(4)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>");
                 out.println("<td align=left>"+rs.getString(2)+" &nbsp&nbsp&nbsp&nbsp</td></tr></table>");
                 out.println("<table><tr><td align=left>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ans: &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp "+rs.getString(3)+"</td></tr></table>");
                
                 
               
                 
                 } 
               
                out.println("<br><br><br>");
                }
                else
                {   
                PreparedStatement pstmt = con.prepareStatement("select * from fqb where sec='"+section+"' order by qid");
                    
                ResultSet rs= pstmt.executeQuery();
                 out.println("<h2><center>Fill in the Blanks</center></h2>");
                 out.print("<h2><center>"+section+"</center></h2>");
                 int a=1;
                while(rs.next())
                {
                 
                 out.println("<table>");
                 out.println("<tr><td align=center>"+a+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>");
                 out.println("<td align=left>"+rs.getString(2)+" &nbsp&nbsp&nbsp&nbsp</td></tr></table>");
                 out.println("<table><tr><td align=left> ans: &nbsp&nbsp&nbsp&nbsp&nbsp "+rs.getString(3)+"</td></tr></table>");
                 a++;
                 
               
                 
                 } 
               
                out.println("<br><br><br>");
                }                                               
                
            } 
           
            else if(s1==2 && s2==2) 
                { 
                 RequestDispatcher rd=request.getRequestDispatcher("finsert.jsp");
                 rd.forward(request,response);
                }

             else if(s1==2 && s2==3)
              {
                 RequestDispatcher rd=request.getRequestDispatcher("fdelete.jsp");
                 rd.forward(request,response);
                
              }
            else if(s1==2 && s2==4)
              {

                 RequestDispatcher rd=request.getRequestDispatcher("fedit.jsp");
                 rd.forward(request,response);

              }
               else if(s1==3 && s2==1)
               {
                if(section.equals("all"))
                {    
                PreparedStatement pstmt = con.prepareStatement("select * from lqb order by qid");
                    
                ResultSet rs= pstmt.executeQuery();
                out.println("<h2><center>Long Answer type Questions</center></h2>");
                while(rs.next())
                {
                 out.println("<table>");
                 out.println("<tr><th align=center>"+rs.getInt(1)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</th>");
                 out.println("<th align=left>"+rs.getString(3)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</th>"); 
                 out.println("<th align=left>"+rs.getString(2)+" </th></tr>"); 
                 out.println("</table>");
                }    
                
                
                
                }
                else
                 {    
                PreparedStatement pstmt = con.prepareStatement("select * from lqb where sec='"+section+"' order by qid");
                    
                ResultSet rs= pstmt.executeQuery();
                out.println("<h2><center>Long Answer type Questions</center></h2>");
                out.println("<h2><center>"+section+"</center></h2>");
                int a=1;
                while(rs.next())
                {
                 out.println("<table>");
                 out.println("<tr><td align=center>"+a+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>");
                 out.println("<td align=left>"+rs.getString(2)+" &nbsp&nbsp&nbsp&nbsp</td></tr>"); 
                 out.println("</table>");
                 a++;
                }    
                
                
                
                }   
               }
             else if(s1==3 && s2==2)
            {
               
                RequestDispatcher rd=request.getRequestDispatcher("linsert.jsp");
                 rd.forward(request,response);
                
            }
             else if(s1==3 && s2==3)
              {

                RequestDispatcher rd=request.getRequestDispatcher("ldelete.jsp");
                 rd.forward(request,response);

              }
            else if(s1==3 && s2==4)
              {

                 RequestDispatcher rd=request.getRequestDispatcher("ledit.jsp");
                 rd.forward(request,response);

              }
           
         
                else if(s1==4 && s2==1)
               {
                
               if(section.equals("all"))
                {    
                PreparedStatement pstmt = con.prepareStatement("select * from sqb order by qid");
                    
                ResultSet rs= pstmt.executeQuery();
                out.println("<h2><center>Short Answer type Questions</center></h2>");
                while(rs.next())
                {
                 out.println("<table>");
                 out.println("<tr><th align=center>"+rs.getInt(1)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</th>");
                 out.println("<th align=left>"+rs.getString(3)+" &nbsp&nbsp&nbsp&nbsp</th>"); 
                 out.println("<th align=left>"+rs.getString(2)+" &nbsp&nbsp&nbsp&nbsp</th></tr>"); 
                 out.println("</table>");
                }    
                
                
                              
                }
                else
                 {    
                PreparedStatement pstmt = con.prepareStatement("select * from sqb where sec='"+section+"' order by qid");
                    
                ResultSet rs= pstmt.executeQuery();
                out.println("<h2><center>Short Answer type Questions</center></h2>");
                out.println("<h2><center>"+section+"</center></h2>");
                int a=1;
                while(rs.next())
                {
                 out.println("<table>");
                 out.println("<tr><td align=center>"+a+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>");
                 out.println("<td align=left>"+rs.getString(2)+" &nbsp&nbsp&nbsp&nbsp</td></tr>"); 
                 out.println("</table>");
                 a++;
                }    
                
                
                out.println("<br><br><br>");
                out.println("<center><input type=submit value=PRINT name=Print  onclick=window.print()  /></center>");              
                }               
             }
              else if(s1==4 && s2==2)
            {
               
                RequestDispatcher rd=request.getRequestDispatcher("sinsert.jsp");
                rd.forward(request,response);
                
            }
              else if(s1==4 && s2==3)
            {

                RequestDispatcher rd=request.getRequestDispatcher("sdelete.jsp");
                rd.forward(request,response);


            }
             else if(s1==4 && s2==4)
              {

                 RequestDispatcher rd=request.getRequestDispatcher("sedit.jsp");
                 rd.forward(request,response);

              }
             else if(s1==5 && s2==1)
            {

                if(section.equals("all")) 
               {   
                PreparedStatement pstmt = con.prepareStatement("select * from exp order by qid");
                    
                ResultSet rs= pstmt.executeQuery();
                 out.println("<h2><center>Expansions</center></h2>");
                while(rs.next())
                {
                 
                 out.println("<table>");
                 out.println("<tr><td align=center>"+rs.getInt(1)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>");
                 out.println("<td align=left>"+rs.getString(4)+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>");
                 out.println("<td align=left>"+rs.getString(2)+" &nbsp&nbsp&nbsp&nbsp</td></tr></table>");
                 out.println("<table><tr><td align=left>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ans: &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp "+rs.getString(3)+"</td></tr></table>");
                
                 
               
                 
                 } 
               
                out.println("<br><br><br>");
                }
                else
                {   
                PreparedStatement pstmt = con.prepareStatement("select * from exp where sec='"+section+"' order by qid");
                    
                ResultSet rs= pstmt.executeQuery();
                 out.println("<h2><center>Expansions</center></h2>");
                 out.print("<h2><center>"+section+"</center></h2>");
                 int a=1;
                while(rs.next())
                {
                 
                 out.println("<table>");
                 out.println("<tr><td align=center>"+a+" &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>");
                 out.println("<td align=left>"+rs.getString(2)+" &nbsp&nbsp&nbsp&nbsp</td></tr></table>");
                 out.println("<table><tr><td align=left> ans: &nbsp&nbsp&nbsp&nbsp&nbsp "+rs.getString(3)+"</td></tr></table>");
                 a++;
                 
               
                 
                 } 
               
                out.println("<br><br><br>");
                }                            
            }
             else if(s1==5 && s2==2)
            {

                RequestDispatcher rd=request.getRequestDispatcher("einsert.jsp");
                rd.forward(request,response);

            }

            else if(s1==5 && s2==3)
            {

                RequestDispatcher rd=request.getRequestDispatcher("edelete.jsp");
                rd.forward(request,response);

            }
            else if(s1==5 && s2==4)
            {

                RequestDispatcher rd=request.getRequestDispatcher("eedit.jsp");
                rd.forward(request,response);

            }
            

          
         }
	catch(ClassNotFoundException s)
        { 
	out.println("loaderror");
   	}
		catch(SQLException e)
        { 
	out.println(e);
   }
                       
          %> 




</body>    
      
  </html>