Você está na página 1de 45

HTML-[Online library registration form] AIM: To develop an application by using HTML.

HTML: HTML stands for Hyper Text Markup Language . HTML is used for formatting and displaying the webpage. Browser is used to see the result. The basic elements of HTML are tags and entities. ALGORITHM: Step1: Start the program. Step2: Begin the program with the <html> tag and include the necessary <head> and <title>tag. Step3:Begin the <body> part of the coding. Step4: Include the details to be displayed in the body part along with the tags for formatting the display. Step5: Close the necessary tags and end the program with the <html> tag. Step6: Repeat step2 to step5 for creating a registration form for getting user DOB, sex, name, password, Dept and book details. Step7: Use step2 to step5 to create the download link for the user. Step8: Create different frames using <frameset> tag for different activities in the registration form. Step9: Save the file .htm or .html extension. Step 10: View the result using the compatible browser. Step10: Stop the program.

Form.html <html> <head> <title>online libreary registration form</title> </head> <body> <center> <font color="red" size="6" face="courier name"> <hr> <b> online library registration form </b> <hr> </font></center> <font color="blue" size="5"face="time new romen"> <i>please fill following fields</i> </font color="black" size="3" face="fixedup"> ENROLL_NO: <input type="text" name="enroll_no" size="5" maxlenth="5"><br><br> NAME: <input type="text" name="name" size="20" maxlength="50"><br><br> DEPT: <select name="dept"> <option selected="selected"><select </option> <option>cse</option> <option>ece</option>

<option>eee</option> <option>mech</option> <option>it</option> </select><br><br> DATE OF BIRTH: <input type="text" name="dob" size="10" max lenth="10">[dd/mm/yyyy]<br><br> SEX: <input type="radio" name="sex" value="male">male <input type="radio" name="sex" value="female"> semale<br><br> ASSIGN YOUR PASSWORD: <input type="password" name="pswd" maxlenth="20"><br><br> which type of books you like<br> <input type="checkbox" name="book" value="dept_books"> department oriented books<br> <input type="checkbox" name="book" value="prb"> placement related books<br> <input type="checkbox" name="book" value="ntrb"> new trend related books<br> <input type="checkbox" name="book" value="bm"> business magazines<br><br> please type your suggestions<i> online libreary rservation system<br> <textarea name="commands" rows="4" cols="36"></textarea> <center> <input type="submit" value="submit">

<button type="reset" value="clear"> </center> <hr> </font> </form> </body> </html> frame.html <html> <head> <title>online libreary reservation system</title> </head> <frameset cols="30%,*"> <frameset rows="50%,*"> <frame src="index.html" name="index"> <frame src="download.html" name="download"> </frameset> <frame src="form.html" name="form"> </frameset> </frameset> </html> index.html <html> <head> <title>index</title> </head>

<body> <a href="login.html" target="dis">login</a><br><br> <a href="stud reg form.html" target="dis"> student online registration form </a> <br> <br> <a href="let books.html" target="dis"> view latest books in library </a><br><br> <a href="enquiry.html" target="dis"> enquiry </a><br><br> <a href="top_hits.html"target="dis"> top 10 books </a> <br><br> </body> </html> download.html <html> <head> <title> download and upload </title> <head> <body bg color="light blue"> <a href="download1.html" target="dis">download current page </a><br/>

<a href ="upload.html" target="dis">upload the data</a> <br> <a href="download2.html" target="dis"> download </a><br><br> <a href="upload.html " target="dis"> upload </a><br><br> </body>

</html> RESULT: Thus the library registration form is successfully designed using HTML.

ExNO.2 AIM:

HTML AND VBSCRIPT

To develop an application using HTML and VBScript. VBScript: VBScript is a fast and flexible subset of Microsoft visual basic for application languages and is designed to the easy to programming and quick in adding ,active content HTML documents. VBScript content is added to the HTML document in between the <script> tag. VBScript is only supported by Microsoft browsers[internet explorer],when VBScript is inserted into the HTML document, internet explorer browser will read the HTML and interpret the VBScript. The VBScript can be executed immediately or at a later event[click]. ALGORITHM: Step1: Start the program. Step2: Begin the program with the <html> tag and include the necessary <head> ,<frame>and <title>tag. Step3:Begin the <body> part of the coding. Step4: Include the necessary scripting codes in the HTML documents. Step5: Close the necessary tags and end the program with the <html> tag. Step6: Repeat step2 to step5 for creating a welcome page. Step7: Repeat step2 to step5 for creating a login page user name and password. Step8: Repeat step2 to step5 for creating a registration form to get the user details. Step9: Repeat step2 to step5 for creating a form to get the book options and give that net amount. Step10: Save the file .html extension.

Step11: Stop the program. frame.html <html> <title> Online Book Store </title> <frameset rows="20%,*,"> <frame src="index.html" /> <frame src="login.html" name="showframe" /> </frameset> </html> index.html <html> <title> </title> <body bgcolor="olive"> <h1 align=center> Welcome to Online Book Store </h1> </br> <a href ="#" target ="showframe">Home</a>&nbsp&nbsp&nbsp&nbsp&nbsp <a href ="login.html" target ="showframe">Login</a>&nbsp&nbsp&nbsp&nbsp&nbsp <a href ="register.html" target ="showframe">Register</a><br> </body> </html> login.html

<html> <title> </title> <body bgcolor="silver"> <h1 align=center> Enter your details to login online book store !! </h1> </br> <form action="display.html" method="post" name=form1> User Name: &nbsp&nbsp&nbsp&nbsp<input type="text" name="uname" /><br /><br /> Password: &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="password" name="pass" /><br /><br /> <input type="submit" value="Submit" /> </form> <a href ="register.html" target ="showframe">Register</a><br> </body> </html> register.html <html> <title> <script type="text/vbscript"> Sub btn_onclick MsgBox "Please Click OK" Dim name

'name=Document.form2.uname.value name="hi" MsgBox("welcome: " & name) End Sub </script> </title> <body bgcolor="aqua"> <h1 align=center> Enter your details to Register online book store !! </h1> </br> <form action="login.html" method="post" name=form2> Nick Name: &nbsp&nbsp&nbsp&nbsp<input type="text" name="uname" /><br /><br /> First Name: &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="fname" /><br /><br /> Last Name: &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="lname" /><br /><br /> Password: &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="password" name="pass" /><br /><br /> Mail-ID: &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="mid" /><br /><br /> <input type="submit" name="btn" value="Register" /> </form> </body> </html>

display.html <html> <title> </title> <body bgcolor="teal">

<script language="VBScript"> Sub namt_OnFocus() Document.form3.namt.value=Document.form3.qnt.value * Document.form3.amt.value End Sub

Sub by_onClick() MsgBox("Thank You for Purchasing the book" ) End Sub

</script>

<SCRIPT FOR="sel" EVENT="onChange" LANGUAGE="VBScript"> select case document.form3.sel.selectedindex case 0 MsgBox("Please Select any one Book") case 1

Document.form3.amt.value="500" case 2 Document.form3.amt.value="450" case 3 Document.form3.amt.value="300" case 4 Document.form3.amt.value="380" end select </SCRIPT>

<h1 align=center> <label id="lb"></label>Your Book Details !! </h1> </br> <form action="login.html" method="post" name=form3> Book Name: &nbsp&nbsp&nbsp&nbsp <select name="sel"> <option value="Select">Select</option> <option value="Grid Computing">Grid Computing</option> <option value="Web Technology">Web Technology</option> <option value="Mobile Computing">Mobile Computing</option> <option value="Pinciples of Mgt">Pinciples of Mgt</option> </select><br /><br /> Amount: &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="amt" /><br /><br />

Quantity: &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="qnt" /><br /><br /> Net Amount: &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="namt" /><br /><br /> <input type="submit" value="Buy" name="by" /> <input type="reset" value="Reset" name="ba" /> </form> </body> </html> RESULT: Thus the online bookstore program was successfully designed with the help of HTML and VBSCRIPT.

ExNo.3
AIM:

XML-DTD

To develop an application using XML-DTD. Document Type Definition(DTD): DTD stands for Document Type Definition. It is defined as a set of rules that specify how to use. It describes the elements which are contained in others, the attributes of the elements and values taken by the attributes. The DTD are either internal DTD or external DTD. An internal DTD is completely enclosed within the XML document, whereas an external DTD is a DTD file which is referred inside an XML document. DTD file is stored with .dtd extension. DTD is used to check well formedness and validate XML document.

ALGORITHM: Step 1: Start the program. Step 2: Define the elements and attributes using the XML document using DTD. Step 3: Save the file with .xml and .dtd extension. Step 4: Initiate the XML document by specifying the XML version and document type. Step 5: Include the details to be displayed using the necessary user defined tags. Step 6: Close the element tags. Step 7: Stop the program.

PROGRAM 1: INTERNAL DTD: <?xml version=1.0 encoding=UTF_8?> <!DOCTYPE Product[ <!ELEMENT PRODUCTDATA(PRODUCT+)> <!ELEMENT PRODUCT(PRODUCT NAME, DESCRIPTION, PRICE, QUANTITY)> <!ATTLIST PRODUCT PROID(DATA #REQUIRED)>

<!ELEMENT PRODUCT NAME(#PCDATA)> <!ELEMENT DESCRIPTION (#PCDATA)> <!ELEMENT PRICE (#PCDATA)> <!ELEMENT QUANTITY (#PCDATA)> ] <PRODUCT DATA> < PRODUCT PROID=Pool> < PRODUCT NAME> Barbie doll</ PRODUCT NAME> < DESCRIPTION> this is a toy for age group 5-10 years</ DESCRIPTION> < PRICE>$20.00</ PRICE> < QUANTITY> 12 </ QUANTITY> </PRODUCT> </PRODUCT DATA>

PROGRAM 2: EXTERNAL DTD: Menu.dtd: <!ELEMENT BREAKFAST_MENU(FOOD+)> <! ELEMENT FOOD(NAME, PRICE,DESCRIPTION, CALORIES)> <! ELEMENT NAME(#PCDATA)> <! ELEMENT PRICE (#PCDATA)> <! ELEMENT DESCRIPTION (#PCDATA)> <! ELEMENT CALORIES (#PCDATA)> Menu.xml: <?xml version=1.0 standalone=yes?> <!DOCTYPE MENU SYSTEM Menu.dtd> < BREAKFAST_MENU>

< FOOD> < NAME> Belgian Waffler</ NAME> < PRICE> $5.95 </ PRICE> < DESCRIPTION> two of our famous Belgian Wafflers with plenty of red maple syrup </DESCRIPTION> < CALORIES> 650 </ CALORIES> </ FOOD> < FOOD> < NAME> Strawberry Belgian Wafflers</ NAME> < PRICE> $7.95 </ PRICE> < DESCRIPTION> light Belgian Wafflers covered with strawberries and whipped cream </DESCRIPTION> < CALORIES> 700 </ CALORIES> </ FOOD> < FOOD> < NAME> Berry_berry Belgian Wafflers</ NAME> < PRICE> $8.95 </ PRICE> < DESCRIPTION> light Belgian Wafflers covered with an assorted fresh berries and cream </DESCRIPTION> < CALORIES> 900 </ CALORIES> </ FOOD> < FOOD> < NAME> fresh toast</ NAME> < PRICE> $4.50 </ PRICE> < DESCRIPTION> Thick slices made from our home made four dough bread </DESCRIPTION> </ FOOD> </ BREAKFAST_MENU> RESULT:

Thus the XML file is validated for its wellformedness by using DTD.

ExNo.4 AIM:

XML-XSL

To add styles to a xml document using extensible style sheet ALGORITHM: Step 1:Start the program Step 2: Create a XML document with .xml extension Step 3: Create a style sheet document for the XML document and save it with the extension .xsl Step 4: Refer the corresponding xsl file at the starting of the xml document with the help of href attribute. Step 5: View the result using the compatible browser. Step 6: Stop the program. stu.xsl
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > <xsl:output method="html"/> <xsl:template match="student"> <html> <head> <title>Student Record</title> <style> body, p, td, th {font-family:arial,sans-serif} th { text-align:right;} </style> </head> <body> <h1 align="center">Student Record for <xsl:value-of select="first"/> <xsl:text> </xsl:text>

<xsl:value-of select="middle"/><xsl:text> </xsl:text> <xsl:value-of select="last"/> </h1> <hr/> <table cellspacing="2" bgcolor="wheat" border="0"> <tr> <th>Name: </th> <td> <xsl:value-of select="first"/> <xsl:text> </xsl:text> <xsl:value-of select="middle"/> <xsl:text> </xsl:text> <xsl:value-of select="last"/> </td> </tr> <tr> <th>RPI ID#: </th> <td> <xsl:value-of select="rid"/></td> </tr> <tr> <th>Address:</th><td><xsl:value-of select="address"/></td> </tr> <tr> <th>Phone:</th> <td> <xsl:value-of select="phone"/></td> </tr> <tr> <th>Instant Messenger ID:</th><td> <xsl:value-of select="im"/></td> </tr> <tr> <th valign="top">Courses:</th> <td> <xsl:apply-templates select="courses"/> </td> </tr> </table> </body> </html> </xsl:template> <!-- Template that handles the display of a courses element --> <xsl:template match="courses"> <div style="border:solid 2pt black; padding:.1in;"> <p>Courses for <xsl:value-of select="@semester"/>:</p> <xsl:for-each select="course"> <div style="margin:.1in; pading:.1in; border:solid 1pt black; background-color:#ccddee"> <table border="0"> <tr><th>Name:</th><td> <xsl:value-of select="name"/></td></tr> <tr><th>CRN:</th><td> <xsl:for-each select="crn"> <xsl:value-of select="."/> <xsl:text> </xsl:text> <!-- adds whitespace --> </xsl:for-each> </td></tr> <tr><th>Course #:</th><td> <xsl:value-of select="num"/></td></tr> </table> </div>

</xsl:for-each> </div> </xsl:template> </xsl:stylesheet>

stu.xml
<?xml version="1.0"?> <!DOCTYPE student SYSTEM "stu.dtd"> <?xml-stylesheet type="text/xsl" href="stu.xsl"?> <student> <first>Joe</first> <middle>X.</middle> <last>Smith</last> <rid>660012345</rid> <address>123 main street</address> <phone>555-2929</phone> <im>jsiscool</im> <courses semester="fall02"> <course> <name>Exploiting the Information World</name> <crn>12345</crn> <num>ITEC-2110</num> </course> <course> <name>XML DTD Creation</name> <crn>82828</crn> <crn>82839</crn> <num>XML-2250</num> </course> </courses> </student>

RESULT: Thus the xml student record is displayed by adding extensible style sheet ExNo: 5 XML-CSS

AIM: To add styles to a xml document using cascading style sheet ALGORITHM:

Step 1:Start the program Step 2: Create a XML document with .xml extension Step 3: Create a style sheet document for the XML document and save it with the extension .css Step 4: Refer the corresponding css file at the starting of the xml document with the help of href attribute. Step 5: View the result using the compatible browser. Step 6: Stop the program. stu.css
student { display:block; border: solid 2px black; background-color:wheat; width:50% } first,last,middle { border:2; font-family:sans-serif; font-weight: bold; } address,phone,im { dislay:block; font-family:sans-serif; font-weight: bold; display:block } name { font-family:sans-serif; color:green; display: block; font-style:italic} courses { margin-left: .3in; display: block;} course {margin-top:.2in; display:block; border:solid 1px gray} rid,crn { display: block; font-size: 14pt; font-weight: bold; font-family:Courier; color: blue; }

stu.xml

<?xml version="1.0"?> <?xml-stylesheet type="text/css" href="stu.css"?> <student> <first>Joe</first> <middle>X.</middle> <last>Smith</last> <rid>660012345</rid> <address>123 main street</address> <phone>555-2929</phone> <im>jsiscool</im> <courses semester="fall02"> <course> <name>Exploiting the Information World</name> <crn>12345</crn> <num>ITEC-2110</num> </course> <course> <name>XML DTD Creation</name> <crn>82828</crn> <crn>82839</crn> <num>XML-2250</num> </course> </courses> </student>

RESULT: Thus the xml student record is displayed by adding cascading style sheet ExNO.5 AIM: To convert an EDIFACT document in to XML document using any conversion tool ALGORITHM: Step 1: Open the application Stylus Studio 2011 Step 2: In the Menu Click File New then select EDI to XML Conversion Step 3: In the open dialog box click browse button to select the Order_det EDI file Step4: Click OK to continue. EDI FACT

Step5: Studio Step6: Step7: Step8: Step9: Step10: Program

EDI structure with Error Validation is loaded in Stylus Save the EDI structure file with Order_det.sef In the Menu Click EDI the select Preview Result Converted XML file is show in the preview pane Save the file as Order_det.xml and open it in firefox Close the application Stylus Studio 2011.

Order_det.edi
UNB+UNOB:1+PARTNER ID:ZZZ+0038977332:1:MFGB+001230:0000+00000000000001++INVOIC+ +++1'UNH+0001+INVOIC:S:93A:UN'BGM+380+INVOICENBR+9'DTM+137:20000101:102'RFF+ON:CUST-ORDER-NO'NAD+RE+ ::92+ +MANUFACTURER NAME'RFF+VA:DE12931720 6'CTA+AR+:JANE DOE'COM+00 49 89 555-2543:TE'NAD+ST+ ::92++TEST123 CORP.'NAD+BY+ ::92++ABCDEMO CORP.'CUX+2:USD:4'ALC+C++6+ +ABG'PCD+1:2.5'MOA+204:200.00'LIN+1+ +240152:BP'QTY+47:3.00:EA'PRI+AAA:1310.00:CT'LIN+2+ +54372:BP'QTY+47:2.00:EA'PRI+AAA:580.95:CT'UNS+S'MOA+77:5091.90:U SD'TAX+7+VAT++ +:::15+S'MOA+176:248.28:USD'UNT+25+0001'UNZ+1+00000000000001'

Order_det.sef [Generated by Stylus Studio]


.VER 1.61 .INI sample,,S93A,UN,S93A,* .PRIVATE Stylus Studio .SCENARIO .NAME sample .INPUT sample.edi .OUTPUT .RELATIVE_PATH TRUE .EXTERNAL_PREVIEW FALSE .CURRENT

.PUBLIC .PRIVATE DataDirect XML Converter .URL converter:EDI .PUBLIC

Output Order_det.xml [Converted by Stylus Studio]


<EDIFACT> <UNB> <UNB01> <UNB0101><!--0001: Syntax identifier-->UNOB<!--UN/ECE level B--></UNB0101> <UNB0102><!--0002: Syntax version number-->1<!--Version 1--></UNB0102> </UNB01> <UNB02> <UNB0201><!--0004: Sender identification-->PARTNER ID</UNB0201> <UNB0202><!--0007: Partner identification code qualifier->ZZZ<!--Mutually defined--></UNB0202> </UNB02> </UNB> <INVOIC> <UNH> <UNH01><!--0062: Message reference number->0001</UNH01> <UNH02> <UNH0201><!--0065: Message type-->INVOIC<!-Invoice message--></UNH0201> <UNH0202><!--0052: Message version number->S</UNH0202> <UNH0203><!--0054: Message release number->93A</UNH0203> <UNH0204><!--0051: Controlling agency-->UN<!-UN/ECE/TRADE/WP.4, United Nations Standard Messages (UNSM)--> </UNH0204> </UNH02>

</UNH> </INVOIC> <MOA01> <MOA0101><!--5025: Monetary amount type qualifier-->77<!-Invoice amount--></MOA0101> <MOA0102><!--5004: Monetary amount->5091.90</MOA0102> <MOA0103><!--6345: Currency, coded->USD</MOA0103> </MOA> </EDIFACT>

RESULT: Thus the EDI document is converted to XML document using Stylus studio tool.

ExNo.6
AIM:

ASP

To design a website using Active Server pages. ASP: ASP is a powerful tool for making dynamic and interactive Web pages. ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information Services IIS comes as a free component with Windows 2000 IIS is also a part of the Windows NT 4.0 Option Pack ALGORITHM: Step1: Start the program Step2:Open the html document Step3:Specify the title of the form Step4:Include the form and action of the method Step5:Specify the input type and the value of the text and buttons Step6:Create a database for employee Step7:Include the employee details in the database Step8:Retrieve the data with sql query Step9:A record set is created and maintained with respective to the database. Step10:Connection is established through active database objects Step11:Close the html documents

Step12:Stop the program Coding: <html> <head. <title>Search for a phone number</title> </head> <body> <h1>Search for a phone number</h1> <p> <form action=results.asp method=post> Enter Employeer Last name <input type=text name=last name><br> <input type=submit value=Submit> </form> </body> </html> Result.asp: < % @ LANGUAGE=VBSCRIPT %> <html> <head> <title> Search for employee phone number</title> </head> <body> <% Set conn=Server.CreateObject(ADODB>Connection) Conn.Provider=Microsoft.jet.OLEDB.4.0 Conn.open(Server.Mappath(Employees.mdb))

Set rs_main=Server.CreateObject(ADODB.recordset) cid=Request.form(Last name) sql=select * from tbl_employees where Lastname=&cid rs_main.open sql,conn %> <TABLE> <TR> <TD>first name</TD> <TD>Last name</TD> <TD>phone</TD> </TR> <% do while not rs_main.EOF Response.write(<TR>) Response.write(<TD>) Response.write(rs.main(first name)) Response.write(</TD>) Response.write(<TD>) Response.write(rs.main(last name)) Response.write(</TD>) Response.write(<TD>) Response.write(rs.main(phone)) Response.write(</TD>) Response.write(</TR>) Rs_main.movenext Loop %>

</TABLE> </body> </html> Result: Thus the program using ASP is written and executed successfully Output:

Result: Thus the program using ASP is written and executed successfully.

ExNo.7
AIM:

Java Server Pages

To write an order processing program using java server pages.

Introduction to JSP: It is a client server network technology which is an extension of servlet technology. Java server pages simplify the delivery of dynamic web content. They enable web application programmers to create dynamic content by reusing predefined components and by interacting with the components using server side scripting. Java server page programmers can reuse JavaBeans and create custom tag libraries that encapsulate complex, dynamic functionality. Custom-tag libraries even enable web designers who are not familiar with java to enhance web pages with powerful dynamic content and processing capabilities. Java server pages look like standard XHTML or XML documents. They normally include XHTML or XML markup known as fixed template data or fixed template text. JSP normally execute as a part of web server. The server component which executes them is referred to as JSP container

JSP or Servlet Container/Engine:

Servlets/JSP require a Container Apache Tomcat is the reference implementation of the Servlet/JSP Specs It is open source, small, install quickly, and is FREE Web Site: jakarta.apache.org/tomcat It includes a simple HTTP 1.1 server, good enough for development and small intranets.

Tomcat Install:

Requires a JDK, get 1.4.1 and install into c:\jdk or $HOME/jdk.

Add JAVA_HOME to your environment and the bin directory to your PATH Good practice to unpack into c:\tomcat or $HOME/tomcat. Add CATALINA_HOME to your environment and the bin directory to your PATH.

Tomcat Directory Structure:

Everything is relative to $CATALINA_HOME. /bin Startup/shutdown scripts /conf . Server.xml main configuration file /common common class and jar files used by Tomcat and web applications Put JDBC drivers here /server class and jar files used by Tomcat internally /shared class and jar files for all web applications /webapps This is where you put your web application in a sub-directory or external context file.

Starting Tomcat:

bin/startup.bat or startup.sh. Point Browers to http://localhost:8080, should see default page All the Docs are there on the default page!. Check out the examples pages, good tutorials.

Running JSP :

To test JSP,create a directory it the tomcats webapps diretory. Copy the .jsp file in to jsp directory.

Open your web browser and enter the following URL. http://localhost:8080/jsp/test.jsp

Tomcat translates JSP in to servlet and the servlet to respond your request.

ALGORITHM:

Step 1: Start the program. Step 2: Establish a JDBC ODBC connection in the control panel. Step 3: Develop a html web page which dynamically gets the order details from the the user. Step 4: The html invokes the JSP file and passes the request to it. Step 5: In Jsp file,import the necessary header files. Step 6: Store the parameters passed by the html in local jsp variables. Step 7: Create a class instance for jdbc:odbc driver and register it with driver manager. Step 8: Connect to the database. Step 9: Create JDBC statement that will be used to send SQL statements to the database. Step 10: Select the statements for SQL commands. Step 11: Fetch the records from the database one by one till end of the record. Step 12: Get the ISBN number corresponding to the book ordered. Step 13: Write these ordered details as response through printwriter object. Step 14: Catch all the exceptions and close the connections. Step 15: Run the tomcat server and open the html page.

Step 16: Stop the program.

PROGRAM: Order_details.html: <html> <head> <title>ORDER DETAILS</title> </head> <body bgcolor="#00FFFF" text="#000000"> <p><font size="6"> <font color="#800080">ORDER DETAILS</font></font></p> <form method="POST" action="http://localhost:8084/servlet/Order.jsp"> <font size="4">Book:&nbsp;&nbsp;&nbsp; </font> <select size="1" name="D1" style="width: 158; height: 158"> <option>Let_us_C</option> <option>J2EE</option> <option>Perl</option> <option>C++</option> </select> <p> <font size="4">Number of copies:&nbsp;&nbsp;&nbsp;</font> <input type="text" name="T1" size="22"/></p>

<p><font size="4"> Author Name: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;</font> <input type="text" name="T2" size="23"/></p> <p><font size="4"> </font></p> <p><font size="4"> </font> <font color="#800080" size="6">CUSTOMER DETAILS</font></p> <p><font size="6" color="#800080"> </font><font size="4">Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; <input type="text" name="T5" size="23"></font></p> <p><font size="4"> E mail&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ; <input type="text" name="T3" size="23"></font></p> <p><font size="4"> phone No:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" name="T4" size="24"></font></p> <p><font size="4"> Address:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <textarea rows="2" name="S1" cols="20"></textarea></font></p> <p><font size="4">&nbsp;</font></p> <input type="submit" value="Add to shopcart" name="B1"> <input type="reset" value="Reset" name="B2"/> <p>&nbsp;</p>

</form> <p>&nbsp;</p> </body>

Order.jsp: <html> <body bgcolor="#33FFCC"> <%@page import="java.sql.*"%> <% String cusname = request.getParameter("T5"); String noc1 = request.getParameter("T1"); int noc = Integer.parseInt(noc1); String bukname = request.getParameter("D1"); int i = 0; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection c = DriverManager.getConnection("jdbc:odbc:book"); Statement s = c.createStatement(); ResultSet rs = s.executeQuery("select * from bookorder where bname='" + bukname + "'"); if (rs.next()) {%> <head> <title>Congratulations</title> </head> <body bgcolor="#CC6600"> <p align="center"><font color="#800080" size="6"><strong>Congratulations</strong></font></p>

<p><font size="4"></font></p> <p><font size="4"> Dear :&nbsp;&nbsp;&nbsp;<%out.println(cusname);%> </font> <p><font size="4" color="red"> Thank You&nbsp; for Purchasing the Book.&nbsp;&nbsp; </font></p> <p><font size="4"> you had purchased the book :&nbsp;&nbsp;&nbsp;<%out.println(bukname);%></font></p> <p><font size="4"> Number of copies&nbsp; :&nbsp;&nbsp;&nbsp;<%out.println(noc);%></font></p> <p><font size="4"> ISBN Number of the book :&nbsp;&nbsp;&nbsp;<%out.println(rs.getInt("isbnno"));%></font></p> <p><font size="4"> Price of single copy</font> :&nbsp;&nbsp;&nbsp;<%out.println(rs.getInt("price"));%></p>

<p>&nbsp;</p> <p><strong>Please send DD to the following address</strong></p> <p> N0:6,crosscut road,</p> <p>Gandhipuram,</p> <p>Coimbatore.</p>

<% } } catch (Exception ee) { out.println("Error:" + ee); } %> </body> </html> RESULT: Thus the order processing program is written using java server pages and executed successfully.

ExNo.8 AIM:

Java Servlets

To develop an application (currency convertor)in java servlets. ALGORITHM:


ALGORITHM:

Step 1: Start the program. Step 2: Develop a html web page conversion Step 3 Develop a jsp file for the conversion to display the table format to list out the

Step 4 : Import necessary java files Step5 : Extend a class from Http request and response. Step 6 Using for loop calculate the currency value after coneversion Step7: Display the cpnverted table value.

Step 8 Stop the program.

PROGRAM: index.jsp <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <form method="post" action="http://localhost:8084/WebApplication3/CurrencyConvertor"> <table border="1" align="center"> <tbody> <tr> <td> <h1>Welcome To Currency Conversion Page</h1> </td> </tr> <tr> <td align="center"> <input type="submit" value="CONVERT" /> </td>

</tr> </tbody> </table>

</form> </body> </html> CurrencyConvertor.jsp import java.io.*; import java.net.*; import javax.servlet.*; import javax.servlet.http.*; public class CurrencyConvertor extends HttpServlet{ protected void doPost (HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{ response.setContentType("text/html"); PrintWriter out=response.getWriter (); out.println("<html>"); out.println("<head>"); out.println("<title>Dollars to Rupees Conversion chart</title>"); out.println("</head>"); out.println("<body>"); out.println("<center>"); out.println("<h1>Currency Conversion Chart</h1>"); out.println("<table border='1' cellpadding='3' cellspacing='0'>");

out.println("<tr>"); out.println("<th>Dollars</th>"); out.println("<th>Rupees</th>"); out.println("</tr>"); for (int dollars=1; dollars<=15;dollars++) { int rupees=dollars *40; out.println("<tr>" + "<td align='right'>"+dollars+"</td>"+"<td align='right'>"+rupees+"</td>"+"</tr>"); } out.println("</table>"); out.println("</center>"); out.println("</body>"); out.println("</html>"); out.close(); } }

RESULT: Thus the currency convertor is written using java servlet and executed successfully.

ExNo.9

.NET Visual Basic Creation of Directory Wizard

AIM: To develop a Visual basic .NET program for create,rename and delete a directory ALGORITHM: Step 1: Start the program Step 2: Import the system files. Step 3 Create necessary buttons for creating , deleting,updating and renaming the directory Step 4 To each buttons add necessary codings for invoking the methods which displays the response When the options are choosed Step 5: Stop the program.

PROGRAM

Imports System Imports System.IO Public Class Directory_Wizard Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Rename_Main() End Sub Public Shared Sub Rename_Main() Dim path As String = "D:\MyDir" Dim target As String = "D:\TestDir1" Try Directory.Move(path, target) MsgBox("Directory Renamed Successfully") Catch e As Exception MsgBox("The process failed:", e.ToString()) End Try End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Create_Main() End Sub Public Shared Sub Create_Main() Dim path As String = "D:\MyDir" Try If Directory.Exists(path) Then MsgBox("That path exists already:") Return End If Dim di As DirectoryInfo = Directory.CreateDirectory(path) MsgBox("The directory was created successfully", ) ' di.Delete() ' Console.WriteLine("The directory was deleted successfully.") Catch e As Exception MsgBox("The process failed:", e.ToString()) End Try End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Delete_Main() End Sub Public Shared Sub Delete_Main() Dim path As String = "D:\TestDir1" Dim subPath As String = "D:\TestDir1\temp" Try If Directory.Exists(path) = False Then Directory.CreateDirectory(path) End If If Directory.Exists(subPath) = False Then Directory.CreateDirectory(subPath) End If Directory.Delete(path, True) MsgBox("The Directory Deleted Successfully") Catch e As Exception MsgBox("The process failed:", e.ToString()) End Try End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Date_Main() End Sub Public Shared Sub Date_Main() Try Dim dt As DateTime = Directory.GetCreationTime(Environment.CurrentDirectory) If DateTime.Now.Subtract(dt).TotalDays > 364 Then MsgBox("This directory is over a year old.") ElseIf DateTime.Now.Subtract(dt).TotalDays > 30 Then MsgBox("This directory is over a month old.") ElseIf DateTime.Now.Subtract(dt).TotalDays <= 1 Then MsgBox("This directory is over a day old.") Else Console.WriteLine("This directory was created on {0}", dt) End If

Catch e As Exception Console.WriteLine("The process failed: {0}", e.ToString()) End Try End Sub End Class Result: Thus VB.NET program is developed for the directory actions.

ExNo.10 AIM:

C#.NET

To develop an application in C#.NET ALGORITHM: Step 1: Open visual studio. Step 2: Select NewProject Step 3:Select Visual C# Step 4:Select Window Forms Application Step 5: Name the Application Step 6: Click OK Step 7: Add necessary components to default form Step 8: Type the necessary C# codes Step 9: Save and build the solution Step 10: Run the application.

Program
using using using using System; System.Drawing; System.IO; System.Windows.Forms;

namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1()

{ }

InitializeComponent();

void AddDirectories(TreeNode node) { string strPath = node.FullPath; DirectoryInfo dirinfo = new DirectoryInfo(strPath); DirectoryInfo[] adirinfo; adirinfo = dirinfo.GetDirectories(); foreach (DirectoryInfo di in adirinfo) { TreeNode nodeDir = new TreeNode(di.Name); node.Nodes.Add(nodeDir); AddDirectories(nodeDir); } } private void button1_Click(object sender, EventArgs e) { button1.Visible = false; label1.Visible = false; TreeView tree = new TreeView(); tree.Parent = this; tree.Dock = DockStyle.Fill; TreeNode nodeDriveC = new TreeNode(@"D:\TC\"); tree.Nodes.Add(nodeDriveC); AddDirectories(nodeDriveC); } } }

RESULT:Thus the C# program is developed to display

tree view of the directory

Você também pode gostar