Sie sind auf Seite 1von 60

PROGRAM: import java.awt.*; import java.awt.event.* import java.applet.*; //<applet code="color1.

class" height=400 width=450></applet> public class color1 extends Applet implements ItemListener { int currcolor=5; int flag=1; String text="check any of the button"; Button buttons[]=new Button[5]; String colors[]={"Red","Blue","Green","Yellow","Orange"}; Image img; CheckboxGroup cbg=new CheckboxGroup(); Checkbox box1=new Checkbox("Background Color",cbg,true); Checkbox box2=new Checkbox("Text Color" ,cbg,false); Checkbox box3=new Checkbox("Loading Image",cbg,false); public void init() { for(int i=0;i<5;i++) { buttons[i]=new Button(" "); add(buttons[i]); } buttons[0].setBackground(Color.red); buttons[1].setBackground(Color.blue); buttons[2].setBackground(Color.green); buttons[3].setBackground(Color.yellow); buttons[4].setBackground(Color.orange); add(box1); add(box2); add(box3); box1.addItemListener(this); box2.addItemListener(this); box3.addItemListener(this); }

public void itemStateChanged(ItemEvent e) { if(box1.getState()==true) flag=1; else if(box2.getState()==true) { text="defalult color is black"; flag=2; } else if(box3.getState()==true) { img=getImage(getDocumentBase(),"sunset1.gif"); flag=3; } repaint(); } public void paint(Graphics g) { if(flag==2) { g.drawString(text,30,100); switch(currcolor) { case 0:g.setColor(Color.red); break; case 1:g.setColor(Color.blue); break; case 2:g.setColor(Color.green); break; case 3:g.setColor(Color.yellow); break; case 4:g.setColor(Color.orange); break; } g.drawString(text,30,100); } else if(flag==1)

{ g.drawString(text,30,100); switch(currcolor) { case 0:setBackground(Color.red); break; case 1:setBackground(Color.blue); break; case 2:setBackground(Color.green); break; case 3:setBackground(Color.yellow); break; case 4:setBackground(Color.orange); break; } } else if(flag==3) { g.drawImage(img,20,90,this); }} public boolean action(Event e, Object o) { for(int i=0;i<5;i++) { if(e.target==buttons[i]) { currcolor=i; text="you have chosen "+colors[i]; repaint(); return true; } } return false; } }

OUTPUT:

PROGRAM: LIBRARY.CSS: Catalog { font-family:arial; color:red; font-size:16pt; } Book { display:block; font-family:Timesnewroman; color:blue; font-size:14pt; } Title { font-family:arial; color:green; font-size:12pt; } Author { font-family:arial; color:yellow; } Publication,Edition,ISBN,Price { display:block; font-family:arial; color:black; font-size:10pt; margin-left:20pt; } Book1 { display:block;

font-family:Timesnewroman; color:red; font-size:14pt; } Title1 { font-family:Monotype Corsiva; color:violet; font-size:15pt; } Author1 { font-family:arial black; color:pink; } Publication1,Edition1,ISBN1,Price1 { display:block; font-family:Monotype Corsiva; color:black; font-size:10pt; margin-left:20pt; } Book2 { display:block; font-family:Magneto; color:blue; font-size:18pt; } Title2 { font-family:Mistral; color:orange; font-size:16pt; } Author2 { font-family:Matura MT Script Capitals;

color:brown; } Publication2,Edition2,ISBN2,Price2 { display:block; font-family:Algerian; colr:magenta; font-size:10pt; margin-left:20pt; } Book3 { display:block; font-family:Timesnewroman; color:blue; font-size:14pt; } Title3 { font-family:monotype corsiva; color:red; font-size:12pt; } Author3 { font-family:arial narrow; color:yellow; } Publication3,Edition3,ISBN3,Price3 { display:block; font-family:Calibri; colr:green; font-size:10pt; margin-left:20pt; } Book4 { display:block;

font-family:tahoma; color:purple; font-size:14pt; } Title4 { font-family:algerian; color:red; font-size:12pt; } Author4 { font-family:arial narrow; color:pink; } Publication4,Edition4,ISBN4,Price4 { display:block; font-family:arial black; color:pink; font-size:10pt; margin-left:20pt; }

CSSDEMO.XML: <?xml version = "1.0" encoding = "UTF-8" ?> <?xml-stylesheet type="text/css" href="library.css"?> <!DOCTYPE Catalog [ <!ELEMENT Catalog (Book)*> <!ELEMENT Book (Title,Author,Publication.Edition,ISBN,Price)> <!ELEMENT Title (#PCDATA)*> <!ELEMENT Author (#PCDATA)*> <!ELEMENT Publication (#PCDATA)*> <!ELEMENT Edition (#PCDATA)*> <!ELEMENT Price (#PCDATA)*>]> <Catalog>

<Book> <Title>Computer Architecture</Title> <Author>John L.Henessey</Author> <Publication>Elseiver</Publication> <Edition>fifth edition</Edition> <ISBN>9784-4865-78541</ISBN> <Price>$50.8</Price> </Book> <Book1> <Title1>xml Bible</Title1> <Author1>Winston</Author1> <Publication1>wiely</Publication1> <Edition1>fifth edition</Edition1> <ISBN1>0-7645-4760</ISBN1> <Price>$40.5</Price> </Book1> <Book2> <Title2>web technology</Title2> <Author2>Jeffery Jackson</Author2> <Publication2>Pearson</Publication2> <Edition2>fifth edition</Edition2> <ISBN2>0-4567-2347</ISBN2> <Price2>$45</Price2> </Book2> <Book3> <Title3>Computer Graphics</Title3> <Author3>Donald Hearn</Author3> <Publication3>Pearson</Publication3> <Edition3>fourth edition</Edition3> <ISBN3>0-5674-8769</ISBN3> <Price3>$67.5</Price3> </Book3> <Book4> <Title4>world wide web</Title4> <Author4>Robert Sebesta</Author4> <Publication4>Pearson</Publication4> <Edition4>fourth edition</Edition4> <ISBN4>97-5422-5654</ISBN4> <Price4>$44.5</Price4>

</Book4> </Catalog>

OUTPUT:

PROGRAM: <html> <head> <script type="text/javascript"> function formval() { var a = inputform.mark1.value; var b = inputform.mark2.value; inputform.total.value = parseInt(a) + parseInt(b); var name = document.getElementById("name"); var dept = document.getElementById("department"); var regno = document.getElementById("regno"); var mark1 = document.getElementById("mark1"); var mark2 = document.getElementById("mark2"); if(isAlphabet(name,"pls dont enter numbers")&&madeSelection(dept,"please choose a department")&&isNumeric(regno,"enter reg no. oly no.s nd letters allowed for regno.")&&isNumeric(mark1,"enter numbers for mark1")&&isNumeric(mark2,"enter numbers mark2")) { window.alert("successfull validation"); return true; } else { return false; } } function isAlphabet(elem,helperMsg) { var alphaExp = /^[a-zA-z]+$/; if(elem.value.match(alphaExp)) { return true; } else { window.alert(helperMsg);

elem.focus(); return false; } } function madeSelection(elem,helperMsg) { if(elem.value == "1") { window.alert(helperMsg); elem.focus(); return false; } else { return true; } } function isNumeric(elem,helperMsg) { var alphaExp = /^[0-9a-zA-Z]+$/; if(elem.value.match(alphaExp) { return true; } else { window.alert(helperMsg); elem.focus(); return false; } } function isNumeric(elem,helperMsg) { var alphaExp = /^[0-9]+$/; if(elem.value.match(alphaExp)) { return true; } else

{ window.alert(helperMsg); elem.focus(); return false; } } </script> </head> <body> <form name="inputform"> name: <input type="text" name="name"> </br> department: <select id="department"> <option value="1">please choose</option> <option value="2">CSE</option> <option value="3">ECE</option> <option value="4">EEE</option> <option value="5">MECH</option> </select> </br> regno: <input type="text" name="regno"> </br> mark1: <input type="text" name="mark1"> </br> mark2: <input type="text" name="mark2"> </br> total: <input type="text" name="total"> </br> <input type="button" value="submit" name="submit" onclick="return formval();"> </form> </body> </html>

OUTPUT:

PROGRAM:

<html> <head><title>India Map</title><head> <body> <h1 align="Center">India map<h1> <center> <img src="C:\Documents and Settings\ADMINISTRATOR\ My Documents\My Pictures\india.bmp " align="center" usemap="#Cities" height="672" width="597" TITLE="INDIA MAP" ALT="IMAGE DOES NOT EXIST"> </center> <Map Name="cities"> <area shape="CIRCLE" COORDS="240,556,25" href=" C:\Documents and Settings\ADMINISTRATOR\ My Documents\chennai.html " TITLE="This Connects to chennai" TABINDEX="1" > <area shape="CIRCLE" COORDS="119,489,25" href=" C:\Documents and Settings\ADMINISTRATOR\ My Documents\mumbai.htmllTITLE="This Connects to goa" TABINDEX="1" > <area shape="CIRCLE" COORDS="195,208,25" href=" C:\Documents and Settings\ADMINISTRATOR\ My Documents\delhi.html" TITLE="This Connects to delhi" TABINDEX="1" > <area shape="CIRCLE" COORDS="409,335,25" href= C:\Documents and Settings\ADMINISTRATOR\ My Documents\kolkatta.html" TITLE="This Connects to kolkatta" TABINDEX="1" > </map> </body> </html>

CHENNAI.HTML:

<html> <head><title>CHENNAI</title></head> <body > <h1><marquee > WELCOME TO SINGARA CHENNAI</marquee ></h1> <br><br><br><br><br> <p> <center><ul type="disc"> <div align="left" /> <li>Chennai,also known as Madras,the capital of Tamil Nadu,is the country's fourth largest city.</li> <li>Compared to the other major metros of India,it is far less congested and polluted. </li> <li>Chennai was the site of the first settlement of the East India Company.</li> <li>Chennai is a vibrant city that has managed to strike a beautiful balance between the modern and the traditional,a metropolis with a distinct old - world charm.</li> </ul> <center><h3>Intersting Places to visit in Chennai</h3></center> <div align="left" /> <ol> <li>An ancient landmark in the city,is the Madras Harbour,one of the finest in India,and entirely artificial,which has been around for almost a century.</li> <li>Mylapore in the south,is the site of the famous Kapaleeswarar Temple which is dedicated to Lord Shiva. It has a typical Dravidian gopuram. Near the temple,is the San Thome Cathedral,which is said to contain the remains of St Thomas the Apostle (Doubting Thomas)</li> <li>The Government Museum and Art Gallery on Pantheon Road,near Egmore station,has an interesting archaeological section,and a bronze gallery</li> <li>The National Deer Park is the only place in the world,where one can still find a sizeable number of the endangered species of Indian antelope (the black buck). The Deer Park,alongwith the Madras Snake Park,which is supported by the World Wildlife Fund,are located in the Raj Bhavan premises,at Guindy.</li> </ol> <br><br><br><br><br><br> <b>VISIT US AT........</b> <br> www.suntour.com </center> </body> </html>

MUMBAI.HTML: <html>

<head><title>MUMBAI</title></head> <bodybgcolor ="blue " text="white"> <h1><marquee> WELCOME TO MUMBAI</marquee></h1> <br><br><br><br><br > <div align="left" /> <ul type="disc"> <li>Mumbai,the capital of Maharashtra,is the fastest moving,most affluent and industrialised city in India. </li> <li>It is also called the finance capital of India.</li> <li>Mumbai is part of India's beautiful west coast,that runs down from Gujarat,through Mumbai to Goa,Karnataka and Kerala.</li> <li> The city has a natural harbour,which was developed by the British.</li> <li> It is one of the most busy ports of India,handling approximately 40 percent of India's maritime trade.</li> <li>Mumbai is home to people of all Indian creeds and cultures. </li> <li>It is a fascinating city,throbbing with life,and,for many people,the gateway to India.</li> </ul> <center><h3>Intersting Places to visit in mumbai</h3></center> <div align="left" /> <ol> <li>Gateway of India,the principal landmark of Mumbai,was the principal port when the visitors came to India by ship.</li> <li>Sassoon dock is always interesting to visit at dawn,when the fishing boats come in and unload their catch. </li> <li>The area north of Colaba is known as Mumbai Fort,since the old fort was once located here.</li> <li> The Prince of Wales Museum,built to commemorate King George's V visit to India,was opened in 1923. </li> <li>Other attractions of Mumbai include the Juhu beach and the Nehru Planetarium.</li> </ol> <br><br><br><br><br><br> <b>VISIT US AT........</b> <br> www.suntour.com </body> </html>

DELHI.HTML: <html> <head><title>delhi</title></head> <body bgcolor="red " text="white"> <h1><marquee> WELCOME TO DELHI</marquee></h1> <br><br><br><br><br> <din align="left" /> <ul type="disc"> <li>Delhi, the capital of India, is an amalgam of the old and the new.</li> <li> The name Delhi, Dehali, or Dilli is derived from Dhillika, the name of the first medieval township of Delhi, located on the southwestern border of the present Delhi, in Mehrauli.</li> <li>This was the first in the series of seven medieval cities.</li> <li>Delhi is divided into two parts. The old Delhi or Delhi was one of the capitals of Muslim India between the 12th and 19th centuries. New Delhi is the imperial city which was created as the capital by the British.</li> <li>Delhi is a major travel gateway into India. </li> <li>It is one of India's busiest entry points for overseas airlines and is on the overland route access across Asia.</li> <center><h3>Intersting Places to visit in delhi</h3></center> <center> <div align="left" /> <ul type="disc"> <li>Among the places of special interest to tourists in Delhi are the Red Fort, Jama Masjid, Coronation Durbar Site, Raj Ghat, Jantar Mantar, Lakshmi Narayan Temple, Qutab Minar, India Gate, Secretariat Building, Rashtrapati Bhawan, Parliament House, National Museum, National Gallery of Modern Art, Nehru Museum, Rail Transport Museum, International Dolls Museum, Crafts Museum, Gandhi Darshan, Purana Qila, the Zoo, Safdarjung's Tomb, and Bahai House of Worship. </li> </ul></br> </br> </br> </br> <b>VISIT US AT........</b> <br> www.suntour.com </center> </body> </html>

KOLKATA.HTML:

<html> <head><title>KOLKATTA</title></head> <body bgcolor="green " text="white"> <h1><marquee> WELCOME TO KOLKATTA</marquee></h1> <br><br><br><br><br> <div align="left" /> <ul type="disc"> <li>As one enters the city of Kolkata,the impressive Howrah Bridge across the Hooghly river,a huge cantilever structure,supported by two 270 feet high piers,greets the eye.</li> <li> Forming the green heart of the city is the great stretch of lawns called the Maidan.</li> <li>The Maidan is the venue for an assortment of events,ranging from football matches to political rallies. The grounds are also aptly,referred to as the 'lungs of the city.' </li> <li>Kolkata also has shrines and sites of worship belonging to all faiths.</li> <li> The Armenian Church (1650),at Brabourne Road,is one of the oldest churches in the city.</li> </ul> <center><h3>Intersting Places to visit in kolkatta</h3></center> <div align="left" /> <ol> <li>Located 8 kms from Kolkata on the west bank of Ganga are the famous Botanical Gardens.The highlight of the Gardens is the 200 year old banyan tree,said to be the largest in the world.</li> <liThe world's largest estuarine forest in the world,the Sunderbans,the habitat of the Royal Bengal Tiger,which also houses the estuarine crocodile,wild boar and several varieties of birds and snakes,is within easy reach of Kolkata. This famous Project Tiger Reserve can be approached only via the waterways. </li> <li>48 km south of Kolkata is the beautiful Diamond Harbour,at the mouth of the Hooghly,an ideal picnic spot.</li> <li> 12 km from the city centre,on the banks of the Ganga,is the magnificent Dakshineswar Temple,dedicated to Goddess Kali . </li> <li>136 km from the city is the one - of - its - kind university of Shantiniketan,the brainchild of the revered Rabindranath Tagore. Started as an experimental open air classroom,this university has emerged as a universal centre of knowledge and academic excellence,for students and scholars alike.</li> </OL> <br><br><br><br><br><br> <>VISIT US AT........</b> <br> www.suntour.com </body> </html>

OUTPUT:

PROGRAM: import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class ServletDemo extends HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { res.setContentType("text/html"); PrintWriter out=res.getWriter(); Enumeration en=req.getParameterNames(); while(en.hasMoreElements()) { String name_recieved=(String)en.nextElements(); out.print(name_recieved+"="); String value_recieved=req.getParameter(name_recieved); out.println(value_recieved); out.println(" "); } out.close(); } }

STUDENT.HTML: <html> <head> <title>student information form</title> </head> <body> <center><form name="form1" action="http://localhost:8080/examples/servlet/servletDemo"> <h3>enter student imformation in following fields</h3> <table> <tr> <td><b>roll no</b></td> <td><input type="text" name="roll no" size="25"value=" "></td> </tr> <tr> <td><b>student name</b></td> <td><input type="text" name="student name" size="25" value=" "></td> </tr> <tr> <td><b>student address</b></td> <td><input type="text" name="student address" size="50" value=" "></td> </tr> <tr> <td><b>phone</b></td> <td><input type="text" name="phone" size="25" value=" "></td> </tr> <tr> <td><b>total marks</b></td> <td><input type="text" name="total marks" size="10" value=" "></td> </tr> </table> <input type=submit value="submit"> </center> </body> </html>

OUTPUT:

PROGRAM:

STUDENT.XML: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/Xsl" href="SimpleXml.xsl"?> <Student> <Person-Details> <name>Shrishti</name> <address>Pune</address> <year>Second</year> <marks>70 Percent</marks> </Person-Details> <Person-Details> <name>Shreya</name> <address>Chennai</address> <year>Second</year> <marks>90 Percent</marks> </Person-Details> <Person-Details> <name>Shrish</name> <address>Mumbai</address> <year>Fourth</year> <marks>77 Percent</marks> </Person-Details> <Person-Details> <name>Arjun</name> <address>Delhi</address> <year>third</year> <marks>80 Percent</marks> </Person-Details> </Student>

SIMPLEXML.XSL: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>Students Database</h2> <table border="1"> <tr bgcolor="blue"> <th>Name</th> <th>Address</th> <th>Year</th> <th>Marks</th> </tr> <xsl:for-each select="Student/Person-Details"> <tr bgcolor="pink"> <td><xsl:value-of select="name"/></td> <td><xsl:value-of select="address"/></td> <td><xsl:value-of select="Year"/></td> <td><xsl:value-of select="marks"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>

OUTPUT:

PROGRAM: CSS.HTML: <html> <head> <title>CASCADING STYLE SHEETS</title> </head> <body> <center><h2><u><b>CASCADING STYLE SHEETS<b></u></h2></center> <h3><p> The key property of style sheet technology is that it can be used to separate the presentation of information from the information content and semantic tagging</p></h3> <li><a href="inline.html">inline style sheet</a> <li><a href="embedded.html">embedded style sheet</a> <li><a href="external.html">external style sheet</a> </body> <html>

INLINE.HTML: <html> <head> <title>INLINE </title> <body> <b><center><u> INLINE STYLE SHEETS</u></center></b> <p style="font-family:arial;font-size:16;font-color:blue"> this is example for </p> <h1 styles="font-color:blue">INLINE STYLE SHEET</h1> <p style="font-size: x-large; color: #ff9900"> Inline style sheets is a term that refers to style sheet information being applied to the current element. </p> <p style="color:sienna;margin-left:20px"> To use inline styles you use the style attribute in the relevant tag. The style attribute can contain any CSS property. The example shows how to change the color of a paragraph. </p> <p style="background:#ccc; color:#fff; border: solid black 1px;"> An inline style loses many of the advantages of style sheets by mixing content with presentation.

</p> <li><a href="css.html"><center>HOME</center></a> </head> </body> </html>

EMBEDDED.HTML: <html> <head> <title>EMBEDDED</title> <style type="text/css"> h1{font family:arial;color:red} p{font size:14pt;color:green; } .special{color:pink} </style> </head> <body> <b><center><u>EMBEDDED STYLE SHEETS</u></center></b> <p class="special">this is example of</p> <h1 class="special">EMBEDDED STYLE SHEETS</h1> <h2 class="special">An embedded style controls the appearance of a single document</h2> <p class="special">In embedded style sheet the style will be specified in the header section of the html document</p> <h2 class=special>The main advantage of using embedded style sheet is it is very easy to edit
and troubleshoot the code</h2>

<p> <li><a href="css.html"><center>HOME</center></a> </body> </html>

Style.css p{font-size:14pt;color:orange} h1{color:red;background-color:blue} h2{color:yellow;background-color:blue}h3{color:pink;background-color:blue} EXTERNAL.HTML: <html> <head> <title><center>EXTERNAL CSS</center></title> <link rel="stylesheet"type="text/css"href="style.css"/> </head> <body> <b><center><u>EXTERNAL STYLE SHEETS<u></center></b> <h1>this is example of</h1> <p>EXTERNAL STYLE SHEET</p><br/> <h2><p>In the external style sheet the styles are specified in the separate files and linked to the document where the styles are needed using link tag</p><br/></h2> <h3><p> the link element defines a media attribute that can be used to define the type of media for which the style sheet is designed, such as for display on a monitor or output to a printer</p><br/></h3> <p>HTML allows us to associate any number of external style sheets with a document. The style sheet language defines how multiple external style sheets interact</p> <li><a href="css.html"><center>HOME</center></a> </body> </html>

OUTPUT:

PROGRAM:
DATABASE CREATION:

Home.html <html> <head><title> ONLINE EXAMINATION</title></head> <frameset rows="25%,*"> <frame src=one.html name=f1> <frameset cols="15%,*"> <frame src=two.html name=f2> <frame src=three.html name=f3> </frameset> </frameset> </html> One.html <html> <body bgcolor="red"> </br> </br> <center><b><h1>ONLINE EXAMINATION</b></center> </body> </html> Two.html <html> <body bgcolor="pink"> <a href=add1.html target=f3>Exam</a></br> <a href=report1.html target=f3>Result Report</a></br> <a href=report2.html target=f3>Individual Result</a></br> </body> </html> Three.html <html> <body bgcolor="pink"> </body> </html>

Add1.html <html> <body bgcolor="pink"><form action="http://localhost:8080/examples/jsp/add.jsp" method="post"> <center><U><B>ONLINE EXAMINATION</U></CENTER></B> <br> <br> <b>Seat Number:<input type=text name=seatno><br> <b>Student Name:<input type=text name=name><br><BR> <b>1.Every host implementations transport layer</b></br> <input type="radio" name="group1" value="True">True <input type="radio" name="group1" value="False">False<br> <b>2.It is a network layer's responsibility to forward packets reliability from source to destinationr.</b></br> <input type="radio" name="group2" value="True">True <input type="radio" name="group2" value="False">False<br> <b>3.Packet switching is more useful in burstly traffic</b></br> <input type="radio" name="group3" value="True">True <input type="radio" name="group3" value="False">False<br> <b>4.A phone network uses packet switching.</b></br> <input type="radio" name="group4" value="True">True <input type="radio" name="group4" value="False">False<br> <b>5.HTML is a protocol for describing web content.</b></br> <input type="radio" name="group5" value="True">True <input type="radio" name="group5" value="False">False<br> <center><input type=submit value=Submit name=b></td></tr> </form> </body> </html> Add.jsp <%@ page import="java.sql.*"%> <%try { int marks,total=0;

String name,ans1,ans2,ans3,ans4,ans5; Connection con=null; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String s="jdbc:odbc:student"; con=DriverManager.getConnection(s,"",""); Statement st=con.createStatement(); int sno=Integer.parseInt(request.getParameter("seatno")); name=request.getParameter("name"); ans1=request.getParameter("group1"); ans2=request.getParameter("group2"); ans3=request.getParameter("group3"); ans4=request.getParameter("group4"); ans5=request.getParameter("group5"); if(ans1.equals("True")) total+=2; if(ans2.equals("False")) total+=2; if(ans3.equals("True")) total+=2; if(ans4.equals("False")) total+=2; if(ans5.equals("False")) total+=2; st.executeUpdate("insertintostock"+"(seatno,name,marks)values("+sno+",'"+name+"total+); out.println("<h3>updated.......</h3>"); } catch(Exception e) { out.println(e); }%> Report1.html <html> <body> <h2> Online Examination Report of Students</h2> <form action="http://localhost:8080/examples/jsp/report.jsp" method="post"> <center><input type=submit name=s1 value=Show_Report></center> </form>

</body> </html> Report.jsp <html> <body bgcolor="pink"> <%@ page import="java.sql.*"%> <% Connection con=null; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String s="jdbc:odbc:student"; con=DriverManager.getConnection(s,"",""); Statement st=con.createStatement(); ResultSet rs=st.executeQuery("SELECT * FROM stock"); %> <h1><center>STUDENTS REPORT</center></h1> <center><table border=1 bgcolor="yellow"> <tr> <th>SEAT NUMBER</th> <th>NAME</th> <th>MARKS</th> </tr> <% while(rs.next()) { %> <tr> <td><%=rs.getInt(1) %></td> <td><%=rs.getString(2) %></td> <td><%=rs.getInt(3) %></td> </tr> <% } %> </table> </center> </body> </html>

Report2.html <html> <body> <h2> Online Examination Report of Students</h2> <form action="http://localhost:8080/examples/jsp/report2.jsp" method="post"> <input type=text name=seatno><br> <center><input type=submit name=s1 value=Show_Report></center> </form> </body> </html> Report2.jsp <html> <body bgcolor="pink"> <%@ page import="java.sql.*"%> <% Connection con=null; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String s="jdbc:odbc:student"; con=DriverManager.getConnection(s,"",""); Statement st=con.createStatement(); int sno=Integer.parseInt(request.getParameter("seatno")); ResultSet rs=st.executeQuery("SELECT * FROM stock WHERE seatno=" +sno); %> <h1><center>INDIVIDUAL STUDENTS REPORT</center></h1> <% if(!rs.next()) out.println("<h3> The record is not found.</h3>"); else { %> <center><table border=1 bgcolor="yellow"> <tr> <th>SEAT NUMBER</th> <th>NAME</th> <th>MARKS</th> </tr>

<% do { %> <tr> <td><%=rs.getInt(1) %></td> <td><%=rs.getString(2) %></td> <td><%=rs.getInt(3) %></td> </tr> <% } while(rs.next()); } %> </table> </center> </body> </html>

OUTPUT:

Das könnte Ihnen auch gefallen