Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 25

Frame.jsp <html> <body> <center><b><u>TOPICS:</u></b></center><ul> <li><a href="os1.jsp" target="b">operating system</a><br> <li><a href="hw1.jsp" target="b">hardware</a><br> <li><a href="nw1.

jsp" target="b">network</a><br> <form name=s method=get target="b" action="http://localhost:8080/examples/online quiz/sc.jsp"> <input type=submit value="obtain score"><br> </form> </ul> </body> </html>

App.jsp <html> <title>APPLICATION FORM</title> <body bgcolor="gray"> <h1><p align="center"><font face="courier" color="lightgreen">APPLICATION FORM</font></p></h1> <form name=s method=get action="che1.jsp"> Name<input type="text" name="n1"><br> Emailid<input type="emailid" name="e1"><br> Father name<input type="age" name="n2"><br><br> Address<textarea rows="5" cols="30" name="g"></textarea><br> Age<input type="age" age="n2"><br><br><br> <center><input type=submit value="save"> </center><br> </form> </body> </html>

Che.jsp <html> <body bgcolor="pink"> <form name=f method=get action="http://localhost:8080/examples/onlinequiz/app.jsp"> this password is wrong<input type=submit value="BACK"> <%@page language="java" import="java.sql.*"%> <% string s1=request.getParameter("n"); string s2=request.getParameter("e"); string a=null; string b=null; int k=0; connection c=null; try { class.forname("sun.jdbc.odbc.JdbcOdbcDriver"); c=DriverManager.getConnection("jdbc:odbc:siva","",""); statement s=c.createStatement(); ResultSet rs=s.executeQuery("select *from ta"); while(rs.next()) { a=rs.getstring("username"); b=rs.getstring("emailid"); if(a.equals(s1.trim())&&b.equals(s2.trim())) {

%> <jsp:forward page="frame.jsp"> </jsp:forward> <% } } catch(SQLException e) { System.out.println(e); } catch(ClassNotFoundException e) { System.out.println(e); } catch(Exception e) { System.out.println(e); } finally { try { if(c!=null) { c.close(); }} catch(SQLExecption e) { System.out.println(e); } } %> </body> </html>

Che1.jsp <html> <body bgcolor="pink"> <%@page language="java" import="java.sql.*"%> <% string s1=request.getParameter("n1"); string s2=request.getParameter("e1"); session.setAttribute("username",s1); session.setAttribute("emailid",s2); connection c=null; try { class.forname("sun.jdbc.odbc.JdbcOdbcDriver"); c=DriverManager.getConnection("jdbc:odbc:siva","",""); statement s=c.createStatement(); s.executeUpdate("insert into ta values('"+s1+"','"+s2+"')"); {%> <jsp:forward page="frame.jsp"> </jsp:forward> <% } } catch(SQLException e) { System.out.println(e);

} catch(ClassNotFoundException e) { System.out.println(e); } catch(Exception e) { System.out.println(e); } finally { try { if(c!=null) { c.close(); } } catch(SQLExecption e) { System.out.println(e); } } %> </body></html>

Conte.jsp <html> <body> <center><b><u>TOPICS:</u></b></center><ul> <li><a href="os1.jsp" target="b">operating system</a><br> <li><a href="hw1.jsp" target="b">hardware</a><br> <li><a href="nw1.jsp" target="b">network</a><br> <form name=s method=get target="b" action="http://localhost:8080/examples/online quiz/sc.jsp"> <input type=submit value="obtain score"><br> </form> </ul> </body> </html>

Os1.jsp <html> <body> <form name=f method=get action="http://localhost:8080/examples/onlinequiz/os2.jsp"> <center><b><u><h1>os:</h1></u></b></center><ol> <li>the first digital computer was designed by----?<br> <input type="radio"name="o1"value="charles babbage">charles babbage<br> <input type="radio"name="o1"value="k.zuse">k.zuse<br> <input type="radio"name="o1"value="none of these">none of these<br> <li>extension of iocs?<br> <input type="radio"name="o2"value="input output control system">input output control system<br> <input type="radio"name="o2"value="input output connective system">input output connective system<br> <input type="radio"name="o2"value="none of these">none of these<br> <li>the programming of first generation computers was done in----?<br> <input type="radio"name="o3"value="assembly language">assembly language<br> <input type="radio"name="o3"value="machine language">machine language<br> <input type="radio"name="o3"value="high level language">high level language<br> <li>an operating system is a----?<br> <input type="radio"name="o4"value="hardware">hardware<br> <input type="radio"name="o4"value="software">software<br> <input type="radio"name="o4"value="firmware">firmware<br> <li>compiler is an example of----?<br> <input type="radio"name="o5"value="linker">linker<br> <input type="radio"name="o5"value="translator">translator<br> <input type="radio"name="o5"value="assembler">assembler<br>

<input type="submit value="update"></form> <form name=s method=get action="http://localhost:8080/examples/onlinequiz/conte.jsp"> <input type=submit value="home"></form></body> </html>

Os2.jsp <html> <body> <%@page language="java" import="java.sql.*"%> <% connection c=null; try { class.forname("sun.jdbc.odbc.JdbcOdbcDriver"); c=DriverManager.getConnection("jdbc:odbc:siva","",""); statement s=c.createStatement(); string s1=(string)session.getAttribute("username"); string s2=(string)session.getAttribute("emailid"); string i="os"; string n2=request.getParameter("o1"); string n3=request.getParameter("o2"); string n4=request.getParameter("o3"); string n5=request.getParameter("o4"); string n6=request.getParameter("o5"); int a=0; if(n2.equals("charales babbage")) { a=a+10; } if(n3.equals("input output control system")) {

a=a+10; } if(n4.equals("machine language")) { a=a+10; } if(n5.equals("software")) { a=a+10; } if(n6.equals("assembler")) { a=a+10; } s.executeUpdate("insert into t values('"+s1+"','"+s2+"','"+i+"','"+a+"')"); } catch(SQLException e) { System.out.println(e); } catch(ClassNotFoundException e) { System.out.println(e); } catch(Exception e)

{ System.out.println(e); } finally { try { if(c!=null) { c.close(); } } catch(SQLExecption e) { System.out.println(e); } } %> </body> </html>

Quiz.jsp <html> <body bgcolor="lightgreen"> <marquee behavior="alternate" direction="left"> <font face="Castellar" size="12" color="red"> WELCOME TO ONLINE QUIZ </font> </marquee> </body> </html>

Sc.jsp <html> <body bgcolor="pink"> <%@page language="java" import="java.sql.*"%><% Sring a=(String)session.getAttribute("username"); Sring b=(String)session.getAttribute("emailid"); String a1=null; String b1=null; int f=0; int h=0; Connection c=null; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver); c=DriverManager.getConnection("jdbc:odbc:siva","",""); Statement s=c.createStatement(); ResultSet rs=s.executeQuery("select * from t"); %> <center> <font color=blue><h1>QUIZ</h1></center> <table border="2" bordercolor=red bgcolor=pink align=center> <font color=brown><center> <tr> <td colspan="2"></td> <th>Subject</th>

<th>Score</th> while(rs.next()) { a1=rs.getString("username"); b1=rs.getString("emailid"); if(a1.equals(a.trime())&&b1.equals(b.trime())) { %> <tr align=center> <td colspan="2"></td> <td><%out.print(rs.getString("subject"));%> <% f=rs.getInt("marks");%> <td><%out.print(f);%></td></tr> <% } h=h+f; } %> <tr align=center> <td colspan="2"></td> <td> <%out.print("Totalscore");%> </td> <td> <%out.print(h);

%> </td> </tr> <h2>Userrname:<%out.print(a1);%></h2> <h2>Emailid:<%out.print(b1);%></h2> </center> </table> <% s.executeUpdate("insert into t values(('"+s1+"','"+s2+"','"+i+"','"+a+"')"); } catch(SQLException e) { System.out.println(e); } catch(ClassNotFoundException e) { System.out.println(e); } catch(Exception e) { System.out.println(e); } finally { Try { if(c!=null) { c.close(); } } catch(SQLExecption e) { System.out.println(e); }} %> </body> </html>

Welcome.jsp <html> <body bgcolor="cyan"> <h1><center> Select any one topic</center></h1> </body> </html>

You might also like