hi every body! i m doing my online project in jsp..i want to refer some other online exams..so i need source code for online exam application in jsp...any body is there for me to help?

mahmoud_hba commented: good +0

check some quiz sites.

check some quiz sites.

i need online exam source code in jsp

commented: Lazines is no excuse. PS: Not double posting in future and no personal emails in posts -1

So write some. If you have problems, and a specific question, then come back and we will help, but for God's/Allah's/Buddha's/<insert additional diety names here>'s sake, Do Your Own Homework, or at least make an attempt at it.

commented: :) +21
<%@ page contentType="text/html" %>
<%@ page session="true" %>
<%@ page language="java" %>
<%@ page autoFlush="true" import="com.hurix.mhlncms.*, java.util.*"%>
<%@ page import="java.util.*,java.io.*,java.sql.*"%>
<jsp:useBean id="hdbc" class="com.hurix.mhlncms.cmslib.cmsdbconnection.HurixDbconnection" scope="application" />
<jsp:useBean id="mis" class="com.hurix.mhlncms.online" scope="page" />

 <HTML><HEAD><TITLE>Management Information System</TITLE>

<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE type=text/css>
BODY 
{
    MARGIN: 0px
}
</STYLE>

<SCRIPT language=javascript>

        var hr = <%=request.getAttribute("HR") %>
        var sec = 00;   
        var min =00;   
        var count1;

function countDown()
            {
                sec--;

           if (sec == -01)
           {
               sec = 18;
               min = min - 1; 
           }
           else { min = min; }

           if (sec<=9) 
           { sec = "0" + sec; 
           }

           if(min==-01)
           {
                min=0;
                hr= hr++;
           }

            time = (hr<=9 ? "0" + hr : hr)+" : " + (min<=9 ? "0" + min : min)+ " : " + sec ;
         document.online.timeLeft.value = time;

           if (document.getElementById)
           { 
                theTime.innerHTML = time; 
           }

           SD=window.setTimeout("countDown();", 1000);

           if (hr=='00' &&  min == '00' && sec == '00') 
           { sec = "00"; window.clearTimeout(SD); 
                alert("The time is Expiered");


       var inputs=0;
       var cou=0;
       var aa;
  var examdate1 = document.online.examdate1.value;
     for(var x=0;x<10;x++)
      {
          var name= new Array(10) 
          name[0]="TRAP"; 
          name[1]="Dennisriche"; 
          name[2]="ThomasJohn"; 
          name[3]="MarkHoneywell"; 
          name[4]="Active server pages"; 
          name[5]="Shozo Kawasaki"; 
          name[6]="Neither Process Nor Completes Its Work"; 
          name[7]=" Western India Vegetable Products Limited"; 
          name[8]="Java server pages"; 
          name[9]="Object oriented"; 
         //alert("array:"+name[x]);
         inputs = document.getElementsByTagName('input')
         for(var i=0; i < inputs.length; i++)
           { 
               if(inputs[i].checked==true)
                 {
                     aa=inputs[i].value;
                    //alert("The selected value is"+aa);
                     if(aa==name[x])
                        {
                         cou++;
                        }
                 } 
           } 
        }
         alert("count:"+cou);   
        document.location.href="techexam.jsp?cou="+cou+"&examdate1="+examdate1+" ";
   }
}
     window.onload = countDown;

</script>    

  <script text="javascript">

    function getValues()
  {  
      //<%!int j=1;%>
       var inputs=0;
       var cou=0;
       var aa;

      var examdate1 = document.online.examdate1.value;

     for(var x=0;x<10;x++)
      {
          var name= new Array(10) 
          name[0]="TRAP"; 
          name[1]="Dennisriche"; 
          name[2]="ThomasJohn"; 
          name[3]="MarkHoneywell"; 
          name[4]="Active server pages"; 
          name[5]="Shozo Kawasaki"; 
          name[6]="Neither Process Nor Completes Its Work"; 
          name[7]=" Western India Vegetable Products Limited"; 
          name[8]="Java server pages"; 
          name[9]="Object oriented"; 
         //alert("array:"+name[x]);
         inputs = document.getElementsByTagName('input')
         for(var i=0; i < inputs.length; i++)
           { 
               if(inputs[i].checked==true)
                 {
                  aa=inputs[i].value;

                     if(aa==name[x])
                        {
                         cou++;
                        }
                 } 
           } 
       }
       alert("count:"+cou);   
        document.location.href="techexam.jsp?cou="+cou+"&examdate1="+examdate1+" ";
  }

</script>
<script type="text/javascript" src="../JavaScript/datetimepicker.js"></script>

<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
-->
</style>
<link href="../css/form.css" rel="stylesheet" type="text/css">
<link href="../css/style.css" rel="stylesheet" type="text/css">

<%   
    mis.setHurixDbconnection(hdbc);
     String examdate1 = request.getParameter("examdate") != null ?  request.getParameter("examdate") : null;
      String answer = "";
 %> 

<FORM name="online">
<TABLE cellSpacing=0 cellPadding=0 width=776 border=0>
<input type="hidden" name= "examdate1" value="<%=examdate1%>">
  <TBODY>
  <TR>
    <TD class=Form_Header bgColor=#999999>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD class=popheader width=25>&nbsp;</TD>
          <TD class=popheader align=left width=222>Optitude Test </TD>
          <TD align=left width=242 height=25>&nbsp;</TD>
          <TD class=toplink vAlign=center align=left width=211>
            <TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>
              <TR>
                <TD align=right width="28%"><LABEL></LABEL></TD>
                <TD align=right width="28%"><LABEL></LABEL></TD>
                <TD align=right width="25%"><LABEL></LABEL></TD>
                <TD align=middle width="29%"><LABEL>
                  </TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD>&nbsp;</TD></TR>
        <TR>
          <TD>
            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TBODY>


               Exam Timing::<SPAN class=timeClass id=theTime></SPAN>
        <SPAN class=labels id=theTime><input name="timeLeft" id=theTime size="10"></SPAN>
                 <TR vAlign=top align=left>
                 <TD width="10%" height=35>&nbsp;</TD>
                 <TD class=labels borderColor=#dfeaff height=35>
                 <SPAN class=red_marker></SPAN></TD>
                 <TD borderColor=#dfeaff height=35>

        <%
         Connection con = null;
        String strPrjQuery=null;  
        ResultSet rst=null;  
        Statement stmt=null;
        Collection EItemCheck=new Vector();
        int n=0;
        int i=0;
        String q;

        try
        {
            con=hdbc.getConnectionFromPool();

            stmt=con.createStatement(); 
            rst=stmt.executeQuery("select * from PMS_ONLINEWRITTEN ORDER BY dbms_random.value"); 

            while(rst.next())
            {  
             %>


            <INPUT maxLength="100" type="text" name="q<%=n%>" class="fetch"  size="100" value="<%=++n%>. <%=rst.getString("QUESTION")%>"><br>

            <INPUT maxLength="100" type="text" name="ans<%=n%>" class="fetch"  size="100" value=" <%=rst.getString("ANSWER")%>"><br>



                <INPUT maxLength="30" type="radio"  name="ques1 <%=n%>" class="fetch"  value="<%=rst.getString("ANSWER1")%>">
                <INPUT maxLength="100" type="text" name="ques" class="fetch"  size="100" value="<%=rst.getString("ANSWER1")%>"><br>
                 <INPUT maxLength="30" type="radio"  name="ques<%=n%>" class="fetch" value="<%=rst.getString("ANSWER2")%>">
                <INPUT maxLength="100" type="text" name="ques" class="fetch"  size="100" value="<%=rst.getString("ANSWER2")%>"><br>
                 <INPUT maxLength="30" type="radio"  name="ques<%=n%>" class="fetch" value="<%=rst.getString("ANSWER3")%>">
                <INPUT maxLength="100" type="text" name="ques" class="fetch"  size="100" value="<%=rst.getString("ANSWER3")%>"><br>
                 <INPUT maxLength="30" type="radio"  name="ques<%=n%>" class="fetch" value="<%=rst.getString("ANSWER4")%>">
                <INPUT maxLength="100" type="text" name="ques" class="fetch"  size="100" value="<%=rst.getString("ANSWER4")%>"><br><br>

            <%

            } 

            }
        catch(SQLException e)
        {
            throw new SQLException("Error in Retrieving all the Projects ",null,e.getErrorCode());
        }
        finally
        {
            hdbc.putConnectionToPool(con);
        } 

    Collection optians = mis.fetchoptianswer(); 
           int n1=0;
           int x; 
         String answer1="";
        if (optians != null)     
        {
                Iterator iter1     = optians.iterator();
                Vector vect    = new Vector();
                while(iter1.hasNext())
                {
                    vect  = (Vector)iter1.next();
            answer1= vect.elementAt(0).toString();  
            out.println("answer::"+answer1+"<br>");

                }
        }
    %>

 </SPAN></SPAN></TD></TR></TBODY></TABLE></TD></TR>
<TR>
        <TD align=middle>
        <INPUT type=button value=submit onClick="getValues()">
        </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
        </FORM>
        </BODY>
        </HTML>

check this and leave ur feedback...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.