Aim: To Write A Program in XML For Creation of DTD Which Specifies Set of Rules. Script: Note - XML
Aim: To Write A Program in XML For Creation of DTD Which Specifies Set of Rules. Script: Note - XML
Aim: To write a program in XML for creation of DTD which specifies set of rules.
Create a style sheet in CSS & display the document in internet explorer.
Script:
note.xml
<?xml version = "1.0" encoding = "UTF-8" standalone = "yes" ?>
<?xml-stylesheet type="text/css" href="nt.css"?>
<!DOCTYPE address [
<!ELEMENT address (name,company,phone)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT company (#PCDATA)>
<!ELEMENT phone (#PCDATA)>
]>
<address>
<name>Harshvardhan Bahukhandi</name>
<company>Galgotia College</company>
<phone>9406245966</phone>
</
address
>
nt.css
addres
s{
color: white;
background-color : rgb(130, 34, 255);
width: 100%;
}
name {
color: rgb(0,
0, 0); font-
size : 40px;
background-color : powderblue;
}
company
{ display :
block;
}
phone {
font-size :
25px; font-
weight :
bold;
}
OUTPUT
Program-8
Aim: To write a program in java to illustrate Methods of InetAddress Class.
Source Code:
import java.io.IOException;
import java.net.InetAddress;
import java.util.Arrays;
}
Program-9
Aim: Write a program to illustrate JDBC connectivity program for maintaining database for
sending queries.
Code:
import java.sql.* ;
class Db {
public static void main(String[] args) {
try{
}catch(Exception e){
System.out.println(e);
}
}
}
Output:
Program -10
Aim : Install TOMCAT web server and APACHE. Access the developed static web pages for
books web site, using these servers by putting the web pages developed.
Theory:
Set the JAVA_HOME Variable
You must set the JAVA_HOME environment variable to tell Tomcat where to find Java. Failing
to properly set this variable prevents Tomcat from handling JSP pages. This variable should list
the base JDK installation directory, not the bin subdirectory.
install the tomcat server -
now config servlets with tomcat manually -
1st install the tomcat server -> inside c:\drive -> c:\tomcat with 8090 port no.
now create own folder inside c:\tomcat/webapps\ with
- create config files + folder inside Ananya folder -
Ananya
- WEB-INF
-classes - contain the all servlets + bean classes - with package or without package
- web.xml - for servlets & URL mapping
- tld files - for custom tags
- lib contain all jar files
-images - contain all project images
-css - contain all project css files
- js - contain all js files
web pages
or
copy the WEB-INF folder from example folder & paste inside Ananya folder & edit it.
- Web.xml coding
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app>
<display-name>Ananya Servlet and JSP Examples</display-name>
<!-- Servlet mapping -->
<servlet>
<servlet-name>al</servlet-name>
<servlet-class>Hello</servlet-class>
</servlet>
<!-- URL mapping -->
<servlet-mapping>
<servlet-name>al</servlet-name>
<url-pattern>/Wel</url-pattern>
</servlet-mapping>
</web-app>
- now create own servlet file & save inside WEB – INF folder
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Hello extends HttpServlet {
@Override
public void service(HttpServletRequest req, HttpServletResponse res) throws
ServletException , IOException {
String u = (String)req.getAttribute("id");
PrintWriter out = res.getWriter(); // out hold the response writer for
response write
out.println("<body bgcolor = lightyellow><pre><h1>Hello "+u+", Welcome to Servlets</h1>");
}
}
save Inside - WEB-INF\Hello.java
now open the dos prompt -> dos -
c:\tomcat\webapps\Ananya\WEB-INF>set classpath =c:\tomcat\lib\servlet-api.jar; - without any
space
c:\tomcat\webapps\Ananya\WEB-INF>javac -d classes Hello.java now open the web.xml file &
entries for Servlet mapping & URL Mapping.
now open the browser http:\\localhost:8095\Ananya\Wel