Anna University Results November - December 2011 available with your GPA only for Credit System

Exam Results 2012

Exam Results 2012 Inspirational Quotes
Showing posts with label Internet Programming - CS2358. Show all posts
Showing posts with label Internet Programming - CS2358. Show all posts

Tuesday, March 22, 2011

Three-Tier Application Using JSP and Database (Online Examination)


/* Three-Tier Application Using JSP and Database (Online Examination) */

// OnlineExam.jsp

<%@ page language="java" import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
            <%
            String SeatNum,Name;
            String ans1,ans2,ans3,ans4,ans5;
            int a1,a2,a3,a4,a5;
            a1=a2=a3=a4=a5=0;
            Connection connect=null;
            Statement stmt=null;
            ResultSet rs=null;
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        String url = "jdbc:odbc:ExamStudent";
            connect = DriverManager.getConnection(url," "," ");
        if(request.getParameter("action")!=null)
        {
              SeatNum = request.getParameter("Seat_no");
              Name = request.getParameter("Name");
              ans1 =request.getParameter("group1");        
              if(ans1.equals("True"))
                a1=5;
              else 
                a1=0;            
               ans2 = request.getParameter("group2");        
              if(ans2.equals("True"))
                a2=0;
              else
                a2=5;            
              ans3 = request.getParameter("group3");        
              if(ans3.equals("True"))
                a3=0;
              else
                a3=5;            
              ans4 = request.getParameter("group4");        
              if(ans4.equals("True"))
                a4=5;
              else
                a4=0;            
              ans5 = request.getParameter("group5");        
              if(ans5.equals("True"))
                a5=0;
              else
                a5=5;            
              int Total=a1+a2+a3+a4+a5;        
           
               stmt = connect.createStatement();
              String query = "INSERT INTO StudentTable (" + "Seat_no,Name,Marks" +  ") VALUES ('" +SeatNum + "', '" + Name + "', '"+Total+ "')";
              int result = stmt.executeUpdate(query);  
              stmt.close();        
              stmt = connect.createStatement();
              query = "SELECT * FROM StudentTable WHERE Name="+"'"+Name+"'";
              rs = stmt.executeQuery(query);
            %>
            <html><head><title>Student Mark List</title></head>
              <body bgcolor=khaki>
                <center>
                        <h2>Students Marksheet</h2>
                        <h3>Name of the College : JCE College of Engineering</h3>
                        <table border="1" cellspacing="0" cellpadding="0">
                        <tr>
                          <td><b>Seat_No</b></td>
                          <td><b>Name</b></td>
                          <td><b>Marks</b></td>
                        </tr>
                        <%
                         while(rs.next())
                {
                        %>
                           <tr>   
                            <td><%=rs.getInt(1)%></td>
                            <td> <%=rs.getString(2)%></td>
                            <td> <%=rs.getString(3)%></td>
                           </tr>
                          <%
               }
                          rs.close();
                          stmt.close();
                          connect.close();
                         %>
                        </table>
            </center>
            <br/> <br/><br/>                    
                      <table>
                          <tr><td><b>Date:<%=new java.util.Date().toString() %></td></tr>
                            <tr><td><b>Signature: X.Y.Z. <b></td></tr>
                       </table>
                      <div>
 <a href="http://localhost:8090/OnlineExam/OnlineExam.jsp">Click here to go back</a>
            </body>
                </html>
                <%}else{%>
                 <html>
                      <head><title>Online Examination</title>
                          <script language="javascript">
                          function validation(Form_obj)
                          {
                           if(Form_obj.Seat_no.value.length==0)
                           {
                              alert("Please,fill up the Seat Number");
                              Form_obj.Seat_no.focus();
                              return false;
                           }
                                       if(Form_obj.Name.value.length==0)
                           {
                              alert("Please,fill up the Name");
                              Form_obj.Name.focus();
                              return false;
                           }
                                       return true;
                         }
                    </script>   
                  </head>
                  <body bgcolor=lightgreen>
                  <center>
                      <h1>Online Examination</h1>
                  </center>
                        <form action="OnlineExam.jsp" method="post"
                         name="entry" onSubmit="return validation(this)">
                        <input type="hidden" value="list" name="action">
                        <hr/>
                         <table>
                          <tr>
                              <td><h3>Seat Number : </h3></td>
                              <td><input type="text" name="Seat_no"></td>
                          </tr>
                          <tr>
                             <td><h3>Name : </h3></td>
                             <td><input type="text" name="Name" size="50"></td>
                          </tr>
                          <tr>
                            <td><b>Total Marks:5*5=25 </b></td>
                                    <td></td><td></td><td></td><td><b>Time: 15 Min.</b></td>
                          </tr>
                          </table>
                          <hr/>
                            <b>1. XML enables you to collect information once and reuse it in a variety of ways.</b><br/>
                            <input type="radio" name="group1" value="True">True
                            <input type="radio" name="group1" value="False">False<br>
                            <br/>
                           
                            <b>2. In Modern PC there is no cache memory.</b><br/>
                            <input type="radio" name="group2" value="True">True
                            <input type="radio" name="group2" value="False">False<br>
                            <br/>
                           
                            <b>3. JavaScript functions cannot be used to create script fragments that can be used over and over again</b><br/>
                            <input type="radio" name="group3" value="True">True
                            <input type="radio" name="group3" value="False">False<br>
                            <br/>

                            <b>4.The DriverManager class is used to open a connection to a database via
a JDBC driver.</b><br/>
                           <input type="radio" name="group4" value="True">True
                            <input type="radio" name="group4" value="False">False<br>
                            <br/>

                            <b>5. The JDBC and ODBC does not share a common parent</b><br/>
                            <input type="radio" name="group5" value="True">True
                            <input type="radio" name="group5" value="False">False<br>
                            <hr/>
                         
                            <center>
                              <input type = "submit" value="Submit">
                              <input type = "reset" value="Clear"><br><br>
                            </center>
                         </form>
                  <%}%>

 
 
--
By

M.Baran Mahamood

Tuesday, December 28, 2010

Cascading Style Sheets

Algorithm :

Start the cascading program.
Give link from main page to other like cascading, Embedded..
Write the code for separate page finally terminate program

Source code for html Programming for Home page and Cascading, Embedded, Inline style sheet



<!-- Home.html -->

<html>
<head>
<title>Cascading Style Sheets</title>
</head>
<body alink="blue" vlink="brown">
<h1><u><b><font face="Monotype corsiva" color="red">
Different types of Cascading Style Sheets</font> </b></u></h1>
<br />
<font face="Arial"size="6">
<a href ="inline.html" style="text-decoration :none;"> 1. Inline Style Sheet</a><br />
<a href ="embedded.html" style="text-decoration :none;"> 2. Embeded Style Sheet</a><br />
<a href ="external.html" style="text-decoration :none;"> 3. External Style Sheet</a><br />
<a href ="import.html" style="text-decoration :none;"> 4. Imported Style Sheet</a><br /></font>
</body>
</html>

<!-- embedded.html -->


<html>
<head>
<title>Embedded Style Sheet</title>
<style type="text/css">
ol{list-style-type:decimal}
h1{text-align: left; background:antiquewhite;font-family:monotype corsiva;color:red}
h3{text-align: right; font-family:arial;color:blue}
</style>
</head>
<body>
<ol class="lroman"><h1>
<li>Embedded style sheet</li></h1>
<br />
<h3>
Embedded style is the style attached to one specific document.
The information is specified as a content of the style element
inside the head element and wil apply to the entire documents.
</h3></ol>
</body>
</html>

<!-- inline.html -->

<html>
<head>
<title>Inline Style Sheet</title>
</head>
<body>
<ol class="decimal">
<h1 style="font-family :Monotype Corsiva ;background-color:antiquewhite ;"><li> Inline Style Sheet</li></h1>
<h3>
<p style="text-indent :30pt;color:blue;font-family :arial;">
Inine Style is the style attached to one specific element.
The style is specified directly in the start tag as a value of the style attribute well apply
exclusively to this specific element occurrence.
</p></h3>
</ol>
</body>
</html>

<!--  import.html -->

<html>
<head><title>Imported Style Sheet</title>
<link rel= stylesheet href="style2.css" type="text/css">
</head>
<body>
<h1>1. Imported Style Sheet</h1>
<h3> Imported style sheet is a shet that can be imported to another sheet.
This alignes exacting one main sheet containing declarations that apply to
the whle site and partial sheets containing declarations that apply to specific
elements.</h3>
</body>
</html>

<!-- external.html -->

<html>
<head>
<title>External Style Sheet</title>
<link rel=Stylesheet href="style1.css" type="text/css" />
</head>
<body>
<h1>1. External Style Sheet</h1><br />
<h3>
An external style sheet is a template documents/files
containing style info which can be linked with any number
of the documents. This is a very convenient way of formating
the entire site as well as restyling it by editing just one file</h3>
</body>
</html>

<!-- style1.css -->

<style type="text/css">
ol{list-style-type:decimal}
h1{text-align: left; background:antiquewhite;font-family:monotype corsiva;color:Green}
h3{text-align: right; font-family:TimesNewRoman;color:Red}
</style>

<!-- style2.css -->

<style type="text/css">
ol{list-style-type:decimal}
h1{text-align: left; background:antiquewhite;font-family:monotype corsiva;color:Orange}
h3{text-align: right; font-family:arial;color:Yellow}
</style>

Tuesday, December 21, 2010

Creating Image Maps in HTML

Aim :

To create webpage and embed map and fix the hot spots in that map and show related information CS2358 INTERNET PROGRAMMING LABORATORY.

Algorithm :

Start the program for embed map in web page
Create ImageMap.htm file
Set the coordination for the hot spot areaCreate separate html file for separate hot place
Like Tamilnadu,keral,karanadha
Finally terminate the program embed webpage


Source code in HTML programming for embed page CS2358 INTERNET PROGRAMMING LABORATORY.


<!- - Creating and Using Image Maps -->
<!-- ImageMap.html -->

<HTML>
<HEAD>
<TITLE>Image Map</TITLE>
</HEAD>
<BODY>
<MAP id = "picture">
<AREA href = "TamilNadu.html" shape = "circle"
coords = "170, 490, 30" alt = "Tamil Nadu" />
<AREA href = "Karnataka.html" shape = "rect"
coords = "115, 390, 150, 450" alt = "Karnataka" />
<AREA href = "AndhraPradesh.html" shape = "poly"
coords = "165, 355, 200, 355, 220, 380, 170, 425, 165,
355" alt = "Andhra Pradesh" />
<AREA href = "Kerala.html" shape = "poly"
coords = "115, 455, 160, 470, 140, 485, 150, 505, 150,
530, 135, 500, 115, 455" alt = "Kerala" />
</MAP>
<IMG src = "India.Jpg" alt = "India" usemap = "#picture" />
</BODY>
</HTML>

<!-- TamilNadu.html --><HTML>
<HEAD>
<TITLE>About Tamil Nadu</TITLE>
</HEAD>
<BODY>
<CENTER><H1>Tamil Nadu</H1></CENTER>
<HR>
<UL>
<LI>Area : 1,30,058 Sq. Kms.</LI>
<LI>Capital : Chennai</LI>
<LI>Language : Tamil</LI>
<LI>Population : 6,21,10,839</LI>
</UL>
</BODY>
</HTML>



<!-- AndhraPradesh.html --><HTML>
<HEAD>
<TITLE>About Andhra Pradesh</TITLE>
</HEAD>
<BODY>
<CENTER><H1>Andhra Pradesh</H1></CENTER>
<HR>
<UL>
<LI>Area : 2,75,068 Sq. Kms</LI>
<LI>Capital : Hyderabad</LI>
<LI>Language : Telugu</LI>
<LI>Population : 7,57,27,541</LI>
</UL>
</BODY>
</HTML>

<!-- Kerala.html --><HTML>
<HEAD>
<TITLE>About Kerala</TITLE>
</HEAD>
<BODY>
<CENTER><H1>Kerala</H1></CENTER>
<HR>
<UL>
<LI>Area : 38,863 Sq. Kms.</LI>
<LI>Capital : Thiruvananthapuram</LI>
<LI>Language : Malayalam</LI>
<LI>Population : 3,18,38,619</LI>
</UL>
</BODY>
</HTML>

<!-- Karnataka.html --><HTML>
<HEAD>
<TITLE>About Karnataka</TITLE>
</HEAD>
<BODY>
<CENTER><H1>Karnataka</H1></CENTER>
<HR>
<UL>
<LI>Area : 1,91,791 Sq. Kms</LI>
<LI>Capital : Bangalore</LI>
<LI>Language : Kannada</LI>
<LI>Population : 5,27,33,958</LI>
</UL>
</BODY>
</HTML>