Wtprac
Wtprac
Objective: Write HTML/Java scripts to display your CV in navigator, your Institute website,
Department Website and Tutorial website for specific subject.
<html>
<body>
<div id="resume">
<h1>John Doe</h1>
</div>
<h2>Profile</h2>
<p>
educational information.
</p><br />
<h2>Education</h2>
<h3>Masters of Acupuncture and Oriental Medicine,<br />
<ul>
</ul>
<h3>Research Project</h3>
<ul>
<li> Assisted the primary investigator in a double blind, randomized controlled trail conducted
at the Bastyr Center for Natural Health that evaluated the effectiveness of Chinese herbs
towards the control of Diabetes Mellitus in post-menopausal women. Co-authored the research
report that has been submitted for publication to the Journal of Traditional Chinese
Medicine.</li>
</ul>
<ul>
<li> Served as project leader in a fund raising project sponsored by the UniversityStudent
Council towards helping homeless youths’ return back to school.</li>
<h2>Related Experience</h2>
<p>Teaching Assistant</p>
<ul>
<li>Assists professor in the Anatomy & Physiology class.</li>
</ul>
<ul>
<li> Developed activity programs now utilized by the youth ministry in helping children improve
reading skills.</li>
</ul>
<ul><li> Provided social support to patients by reading to them, writing letters, and visiting with
them. </li>
<div id="bottom">
</div>
</div></body></html>
PROGRAM-2
Objective: Write an HTML program to design an entry form of student details and send it to
store at database server like SQL, Oracle or MS Access.
<!DOCTYPE html>
<html>
<head><title>PHP insertion</title>
<body>
<div class="maindiv">
<div class="form_div">
<div class="title">
</div>
<h2>Form</h2>
<label>Name:</label>
<label>Email:</label>
<label>Contact:</label>
<label>Address:</label>
</form></div></div></body></html>
<?php
Server
URL
$name = $_POST['name'];
$email = $_POST['email'];
$contact = $_POST['contact'];
$address = $_POST['address'];
'$address')");
} else{
}}
?>
PROGRAM 3
Objective: Write programs using Java script for Web Page to display browsers information.
<!DOCTYPE HTML>
<html>
<body>
<div id="example"></div>
<script>
document.getElementById("example").innerHTML=txt;
</script>
</body>
</html>
PROGRAM 4
Objective: Write a Java applet to display the Application Program screen i.e. calculator and
other.
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/* <applet code="Calculator" width="700" height="200">
</applet>*/
public class Calculator extends Applet implements ActionListener {
String msg = "";
TextField t1, t2, t3;
Button b1, b2, b3, b4;
Label l1, l2, l3;
public void init() {
l1 = new Label("First Number");
add(l1);
t1 = new TextField(15);
add(t1);
l2 = new Label("Second Number");
add(l2);
t2 = new TextField(15);
add(t2);
l3 = new Label("Result");
add(l3);
t3 = new TextField(15);
add(t3);
b1 = new Button("ADD");
add(b1);
b1.addActionListener(this);
b2 = new Button("SUB");
add(b2);
b2.addActionListener(this);
b3 = new Button("MULT");
add(b3);
b3.addActionListener(this);
b4 = new Button("DIV");
add(b4);
b4.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == b1) {
int x = Integer.parseInt(t1.getText());
int y = Integer.parseInt(t2.getText());
int sum = x + y;
t3.setText(" " + sum);
}
if (e.getSource() == b2) {
int x = Integer.parseInt(t1.getText());
int y = Integer.parseInt(t2.getText());
int sub = x - y;
t3.setText(" " + sub);
}
if (e.getSource() == b3) {
int x = Integer.parseInt(t1.getText());
int y = Integer.parseInt(t2.getText());
int mul = x * y;
t3.setText(" " + mul);
}
if (e.getSource() == b4) {
int x = Integer.parseInt(t1.getText());
int y = Integer.parseInt(t2.getText());
int div = x / y;
t3.setText(" " + div);
}
showStatus(" text & button example");
repaint();
}
}
PROGRAM 5
Objective: Writing program in XML for creation of DTD, which specifies set of rules. Create a
style sheet in CSS/ XSL & display the document in internet explorer.
import java.sql.*;
// Database credentials
try{
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Connecting to database...");
conn = DriverManager.getConnection(DB_URL,USER,PASS);
System.out.println("Creating statement...");
stmt = conn.createStatement();
String sql;
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()){
int id = rs.getInt("id");
//Display values
rs.close();
stmt.close();
conn.close();
}catch(SQLException se){
se.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}finally{
try{
if(stmt!=null)
stmt.close();
}catch(SQLException se2){
try{
if(conn!=null)
conn.close();
}catch(SQLException se){
se.printStackTrace();
}//end try
System.out.println("Goodbye!");
}//end main
}//end FirstExample
PROGRAM 7
Objective: Install TOMCAT web server and APACHE. Access the above developed static web
pages for books web site, using these servers by putting the web pages developed.
You must set the JAVA_HOME environment variable to tell Tomcat where to find Java.
<DefaultContext reloadable="true"/>
Be sure to make a backup copy of server.xm before making the above change.
To enable the invoker servlet, uncomment the following servlet and servlet-mapping elements
in
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</servlet-class>
</servlet>
…
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>.
PROGRAM 8
Objective: Install a database (Mysql or Oracle). Create a table which should contain at least the
following fields: name, password, email-id, phone number Write a java program/servlet/JSP to
connect to that database and extract data from the tables and display them. Insert the details
of the users who register with the web site, whenever a new user clicks the submit button in
the registration page.
Code:
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB