web tech updated lab
DESCRIPTION
web tech labTRANSCRIPT
EX NO-6aSIMPLE SERVLETDATE:
AIM:
To write a html and servlet to demonstrate invoking a servlet from html.
ALGORITHM:
Create one root directory
Now create another folder web-inf in the root directory, this web-inf folder contains web.xml file
Create classes folder with in web-inf folder
Compile our servlet program which is in src folder, so we will get one .class file right, just copy this .class file into classes folder in web-inf folder
By the way, we are going to run our servlet by using Tomcat server. So we must set the class path for Tomcat related jar file, servlet-api.jar
You can find this jar file in your Tomcat 1.0\lib.
Open the command prompt and type C:Program Files\Apache Software foundation\tomcat 7.0\web-apps\root\web inf\classes.
Compile the file using the path C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\servlet-api.jar
Run the file in IE
Ex.No:6(b)Date:SERVLET WITH HTML
AIM:To write a Html program for invoking servlet with html.
ALGORITHM:Start the program.
Client:a)In the MyServlet Class on the client side,declare the contents that you like to transfer to the server using html form and input type tags.b)Create a Submit button and close all the included tags.
Server:a)In the sevelet side using the parameter request get the string declared in the client.b)Include the neccesary html coding that helps to displays the content
stop the program
Ex no:7(A) SIMPLE DATABASE CONNECTION USING JSPDate:
AIM:To write a program using JSP with database connection.
ALGORITHM:
1.Create a html file with form tag.
2.The form tag action=http:\\localhost:8080\login.
3.Create two text boxes user id,first name,last name and password and button submit.
4.Import the neccessary packages.
5.Declare the connection,statement and result set object.
6.Check the database connection in the jsp file.
7.The data are inserted into the corresponding table.EX NO:7 b) DATE: PROGRAMS USING THREE-TIERS APPLICATIONS USING JSP
AIM:To write java servlet programs to conduct online examination and to display student mark list available in a database.ALGORITHM:Start the program
Client: In index.html on the client side declare the contents that you like to transfer to the server using html form and input type tags.
create a submit button and close all the included tags.
Servlet: Import all necessary packages
Define a class that extends servlet
In the doPost() method, do the following: Set the content type of the response to "text/html"
Create a writer to the response
Get a paratmeter from the request
If its value is equal to right answer then add 5 to mark variable
Similarly repeat step for all parameters
Display the result in an html format using the writer
End the program.
Ex.No:8a Date: XML- DOM PARSING
AIM:
To write a program for implementing bank information in xml document using DOM.
ALGORITHM:
i) Start the program
ii) In java program, import all necessary packages and declare the class DOMExampleJava.
iii) Then create a file object for the Stocks.xml file
In XML program, create the bank information
Display the bank information using the java file.
Stop the program
EX NO:8 b)DATE: PROGRAM USING XML-XSLT
AIMTo implement XSLT in XML document.ALGORITHM:Start the program
Create an XML document with the details of the student such as name, address, standard and mark.
Import an XSL file to the xml file.
The XSL file imported puts the details of the students given in the xml file in a table and gets the details of each student from the xml file using the value-of attribute.
The output in the browser would be the details from the XML file with the style specified in XSL applied to it. Stop the program.Ex NO:9 PROGRAM USING AJAXAIM:
To write programs to search and display chemistry elements definition detailusing JSP.
ALGORITHM:Start the Program Enter the chemistry element in index.html Read the element data by request.getParameter() on chems.jsp. Check given element in element list. Display the definition of given element. Stop the Program