IP Printout

download IP Printout

of 43

Transcript of IP Printout

  • 8/2/2019 IP Printout

    1/43

    30609104052

    INTERNET PROGRAMMING LAB INDEX

    S.NO DATE NAME OF EXPERIMENT MARK SIGN

    FIXING HOT SPOTS

  • 8/2/2019 IP Printout

    2/43

    30609104052

    PROGRAM:

    Index home page:

    Delhi web page:

    DELHI

    Welcome to DELHI

    About DELHI:

    Delhi is the capital of INDIA. It is one of the metropolitan cities in INDIA. It is the ancient andadvanced city.Indian politics is mainly concentrates in this city.The Supreme court and defense headquarters arelocated in the city.

    Important places:

    1.India Gate
    2.Taj Mahal
    3.Ancient Buildings

    Chennai web page:

  • 8/2/2019 IP Printout

    3/43

    30609104052

    CHENNAI

    Welcome to CHENNAI

    About CHENNAI:

    Chennai is the capital of the state Tamil Nadu.It is one of the metropolitan cities in INDIA. It ranks 4th best city in INDIA.The city has International airport as wll as world's second beach MARINA.It has IT industry focus today.

    Important places:

    1.Marina Beach
    2.Satyam Theater
    3.Express Avenue

    Output:

  • 8/2/2019 IP Printout

    4/43

    30609104052

    Index Home page:

    Delhi web page:

  • 8/2/2019 IP Printout

    5/43

    30609104052

    Chennai web page:

    CASCADING STYLE SHEETS

  • 8/2/2019 IP Printout

    6/43

    30609104052

    PROGRAM:

    Inline Styles

    This text doesn't have any style applied to it.

    The style is applied to "JEPPIAAR" text

    this text has been formated

    Linking to External style sheetDepartmentsCSEITMCAECEEEE

    Go to Jeppiaar website

    body{background-color:cyan}h1{background-color:#00ff00}he{background-color:transparent}p{background-color:rgb(0,90,255)}Jeppiaar Engineering College
  • 8/2/2019 IP Printout

    7/43

    30609104052

    Chennai

    This is reputed college in TN


    This College has sister institution
    Sathyabama University

    body{background-image:url("C:\Documents and Settings\All Users\Documents\My Pictures\SamplePictures\Sunset.jpg")}

    h1{text-align:center}h2{text-align:left}h3{text-align:right}DepartmentsCSE
    ITE
    ECEComputer Science
    Information Tech
    Electronicsh1{font-size:150%}h2{font-size:130%}p{font-size:100%}computer science and engineeringjeppiaar engineering college

    computer science department
    has well equiped central lab

  • 8/2/2019 IP Printout

    8/43

    30609104052

    h1{font-style:italic}h2{font-style:normal}p{font-style:oblique}

    jecjeppiaarnagar

    chennai

    p.one

    {border-style:solid;border-color:#0000ff}p.two{border-style:solid;border-color:#ff0000#0000ff}p.three{border-style:solid;border-color:#ff0000#00ff00 #0000ff}p.four{border-style:solid;border-color:#ff0000#00ff00 #0000ffrgb(250,0,255)}

    note:our college has 8 branches

    our college has dnv

    note:our college has iso 9001

    we have pg courses

  • 8/2/2019 IP Printout

    9/43

    30609104052

    p.margin{margin:2cm 4cm 3cm 4cm}

    jec is reputed college in sister institution
    our sister institution include:

    style type="text/css">img.x{position:absolute;left:0px;top:0px;

    z-index:-1}img.x{position:absolute;left:0px;top:0px;z-index:-1}jec

    this is well reputed college

    Output:

  • 8/2/2019 IP Printout

    10/43

    30609104052

    DHTML PROGRAMMING

  • 8/2/2019 IP Printout

    11/43

    30609104052

    PROGRAM:

    (i)Echo dynamically:

    functionsameInfo(){for (i=0; i

  • 8/2/2019 IP Printout

    12/43

    30609104052

    Before submitting:

    After Submitting:

    Dynamically Changed:

  • 8/2/2019 IP Printout

    13/43

    30609104052

    (ii)Right Click disabled:

  • 8/2/2019 IP Printout

    14/43

    30609104052

    Program:

    document.onmousedown=disable; //IEmessage="Sorry no rightclick on this page.\nNow you cannot view my source\nand you cannotsteal my images";function disable(e){if (e == null){ //IE disablee = window.event;

    if (e.button==2){

    alert(message);return false;}

    }document.onclick=ffdisable; //FF}functionffdisable(e){if (e.button==2){ //firefox disablee.preventDefault();e.stopPropagation();alert(message);return false;}

    }

    Right-click on this page to trigger the event.

    Note that this does not guarantee that someone won't view the page source or steal theimages.

    Output:

  • 8/2/2019 IP Printout

    15/43

    30609104052

    COLOR PALLETE

  • 8/2/2019 IP Printout

    16/43

    30609104052

    PROGRAM:

    importjavax.swing.*;importjava.awt.event.*;

    importjava.awt.*;importjavax.swing.event.*;importjava.util.*;/* */

    public class ColorPallete extends JApplet implements ActionListener{JPanel p,p1;JButton b0=new JButton();JButton b1=new JButton();JButton b2=new JButton();

    JButton b3=new JButton();JButton b4=new JButton();Checkbox c,c1;JTextArea area;Color d0=Color.red;Color d1=Color.green;Color d2=Color.blue;Color d3=Color.pink;Color d4=Color.white;Color dd[]=new Color[5];dd[0]=Color.RED;/*ArrayList d=new ArrayList();d.add(Color.RED);d.add(Color.GREEN);d.add(Color.BLUE);d.add(Color.PINK);d.add(Color.WHITE);*/GridLayout g;public void init(){

    p=new JPanel();p1=new JPanel();g=new GridLayout(2,2);

    int i;b0.setBackground(d0);b1.setBackground(d1);b2.setBackground(d2);b3.setBackground(d3);b4.setBackground(d4);area=new JTextArea("Welcome to color pallete",25,25);CheckboxGroupcbg=new CheckboxGroup();

  • 8/2/2019 IP Printout

    17/43

    30609104052

    c=new Checkbox("Fore Ground",cbg,true);c1=new Checkbox("Back Ground",cbg,false);

    p.add(c);p.add(c1);p.add(area);

    p1.add(b0);p1.add(b1);p1.add(b2);p1.add(b3);p1.add(b4);b0.addActionListener(this);b1.addActionListener(this);b2.addActionListener(this);b3.addActionListener(this);b4.addActionListener(this);p.add(p1);

    getContentPane().add(p);}public void actionPerformed(ActionEvent e){if(c.getState())area.setForeground(((JButton) e.getSource()).getBackground());elsearea.setBackground(((JButton) e.getSource()).getBackground());}}

    Output:

  • 8/2/2019 IP Printout

    18/43

    30609104052

    Foreground:

    Background:

  • 8/2/2019 IP Printout

    19/43

    30609104052

    SERVLETS

  • 8/2/2019 IP Printout

    20/43

    30609104052

    (i)Invoking servlets from HTML forms:

    Program:

    HTML Form:

    Oredering PenBig
    Medium
    Small
    Quantity

    Item

    Servlet Code:

    importjavax.servlet.*;importjavax.servlet.http.*;import java.io.*;

    public class myForm extends HttpServlet{public void doPost(HttpServletRequestrequest,HttpServletResponse response){PrintWriter out;int cost=Integer.parseInt(request.getParameter("cost"));int quant=Integer.parseInt(request.getParameter("quant"));String m=request.getParameter("item");try{out=response.getWriter();out.println("Order");out.println("Your Order for "+m+" of cost "+cost+" is accepted. Your total Bill isRs."+cost*quant+".");out.println("");}catch(Exception e){}}}

    Output:

  • 8/2/2019 IP Printout

    21/43

    30609104052

    Servletrunner:(cmd prompt)

    Before Submitting:

  • 8/2/2019 IP Printout

    22/43

    30609104052

    After Submitting:

    (ii)Invoking servlets from Applets:

  • 8/2/2019 IP Printout

    23/43

    30609104052

    Program:

    Applet Code:

    importjavax.swing.*;importjavax.swing.event.*;importjava.awt.*;importjava.awt.event.*;importjava.applet.*;import java.net.*;

    /* */

    public class invokeHyp extends JApplet{

    String msg="";JButtonsubmit,reset;JPanel p=new JPanel();JLabel lb1=new JLabel("Enter Quantity :");JLabel lb2=new JLabel("Enter Item Name:");JTextField item=new JTextField();JTextField quant=new JTextField();

    public void paint(Graphics g){g.setColor(Color.WHITE);g.fillRect(5,100,50,50);g.setColor(Color.BLACK);g.drawString(msg,6,110);}

    public void init(){submit=new JButton("Submit");reset=new JButton("Reset");p.setLayout(new GridLayout(3,3));p.add(lb2);p.add(item);p.add(lb1);p.add(quant);p.add(submit);p.add(reset);add(p,BorderLayout.NORTH);

    submit.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){msg="Submit";

  • 8/2/2019 IP Printout

    24/43

    30609104052

    try{System.out.println("Hai");URL myurl=new URL("http://localhost:8080/myName?item="+item.getText()+"&quant="+quant.getText());getAppletContext().showDocument(myurl);

    }catch(Exception e1){msg=e.toString();System.out.println(msg);}finally{repaint();}}});

    reset.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){msg="Reset";repaint();}});}}

    Servlet Code:

    importjavax.servlet.*;importjavax.servlet.http.*;import java.io.*;

    public class myName extends HttpServlet{public void doGet(HttpServletRequestrequest,HttpServletResponse response){PrintWriter out;int quant=Integer.parseInt(request.getParameter("quant"));String m=request.getParameter("item");try{out=response.getWriter();out.println("Order");out.println("Your order for "+quant+" number of "+m+" is accepted.");out.println("");}catch(Exception e){}}}Output:

  • 8/2/2019 IP Printout

    25/43

    30609104052

    Servletrunner:(cmd prompt)

    Applet Running:

    THREE TIER APPLICATION

  • 8/2/2019 IP Printout

    26/43

    30609104052

    (i)Online Examination:

    Program:

    HTML Form:

    Online Exam1.Who invented mainframe systems?


    2.What is SriLanka's Capital?
    3.What is national sport of India?

  • 8/2/2019 IP Printout

    27/43

    30609104052

    Servlet Code:

    importjavax.servlet.*;importjavax.servlet.http.*;import java.io.*;

    public class MyServlet extends HttpServlet{public void doGet(HttpServletRequestrequest,HttpServletResponse response){PrintWriter out;String m1=request.getParameter("s1");String m2=request.getParameter("s2");String m3=request.getParameter("s3");int score=0;if(m1.equalsIgnoreCase("ibm"))score=score+5;if(m2.equalsIgnoreCase("Colombo"))

    score=score+5;if(m3.equalsIgnoreCase("hockey"))score=score+5;try{out=response.getWriter();out.println("Result");out.println("Your Score:"+score);out.println("");}catch(Exception e){}}}

  • 8/2/2019 IP Printout

    28/43

    30609104052

    Output:

    Servletrunner:(cmd prompt)

    Before Submitting:

  • 8/2/2019 IP Printout

    29/43

    30609104052

    After Submitting:

  • 8/2/2019 IP Printout

    30/43

    30609104052

    (ii)Student result:

    Program:

    HTML Form:

    Exam ResultResult

    Registration no:

    Servlet Code:

    import java.io.*;import javax.servlet.*;import javax.servlet.http.*;import java.util.*;import java.sql.*;import java.lang.*;public class ResultServlet extends HttpServlet{static String msg="";static String a[]=new String[10];public static void showResultSet(Statement stat) throws SQLException{ResultSet result=stat.getResultSet();ResultSetMetaData metaData=result.getMetaData();int columnCount=metaData.getColumnCount();while(result.next()){

  • 8/2/2019 IP Printout

    31/43

    30609104052

    for(int i=1;i

  • 8/2/2019 IP Printout

    32/43

    30609104052

    {PrintWriter out;int reg=Integer.parseInt(request.getParameter("reg"));/*String msg=*/getInfo(reg);try

    {out=response.getWriter();out.println("Result");out.println(msg);out.println("");}catch(Exception e){}}}

    Output:

    Servletrunner:(cmd prompt)

    Before Submitting:

  • 8/2/2019 IP Printout

    33/43

    30609104052

    After Submitting:

    XML-SCHEMA-XSL

  • 8/2/2019 IP Printout

    34/43

    30609104052

    PROGRAM:

    XML fIle:

    Belgian Waffles$5.95two of our famous Belgian Waffles with plenty of real maple syrup650

    Strawberry Belgian Waffles$7.95light Belgian waffles covered with strawberries and whipped cream900Berry-Berry Belgian Waffles$8.95light Belgian waffles covered with an assortment of fresh berries and whippedcream900French Toast$4.50thick slices made from our homemade sourdough bread600Homestyle Breakfast$6.95two eggs, bacon or sausage, toast, and our ever-popular hash browns950

    XSL-Sheet:

  • 8/2/2019 IP Printout

    35/43

    30609104052

    - (calories per serving)

    Output:

    XML-SCHEMA-XSLT

  • 8/2/2019 IP Printout

    36/43

    30609104052

    PROGRAM:

    XML fIle:

    GaneshKumarSoftware ProgrammerMicrosoftUSA

    34567865453152464564564gan_kuamar@yahoo.in132SenthilRamkumarControl DesignerIBMIndia,[email protected] Schema Definition:

  • 8/2/2019 IP Printout

    37/43

    30609104052

    Output:

  • 8/2/2019 IP Printout

    38/43

    30609104052

    AJAX PROGRAMMING

  • 8/2/2019 IP Printout

    39/43

    30609104052

    PROGRAM:

    HTML form file:

    Function ;postRequest(StrURL);{varxmlHttp;if(window.XMLHttpRequest){//For Mozilla, Safari,.varxmlHttp=new XMLHttpRequest();}else if (window.ActiveXObject){//For Internet ExplorervarxmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}xmlHttp.open(POST,strURL,true);

    xmlHttp.setRequestHeader(Content-type, application/x-www-form-urlencoded);xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){updatepage(xmlHttp.responseText);}}xmlHttp.send(strURL);}functionupdatepage(str){if(str=="yes"){alert("welcome User");}else {alert(Invalid Login! Please try again! ");}}functioncall_login(){var username=window.document.f1.username.value;var password=window.document.f1.password.value;varurl="login.php?username="+username+"&password="+password;postRequest(url);}

  • 8/2/2019 IP Printout

    40/43

    30609104052

    Width="287">Login

  • 8/2/2019 IP Printout

    41/43

    30609104052

    Login form:

    Reply from PHP File:

    AIRLINE AGENT TICKET RESERVATION

  • 8/2/2019 IP Printout

    42/43

    30609104052

    PROGRAM:

    XML fIle:

    This port type references the operations the Travel Agentperforms with the Traveler service

  • 8/2/2019 IP Printout

    43/43

    30609104052

    Output: