aspose file tools*
The moose likes Servlets and the fly likes Server Side Includes. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Server Side Includes." Watch "Server Side Includes." New topic
Author

Server Side Includes.

Dhaval Patel
Greenhorn

Joined: Jan 02, 2001
Posts: 7
Hi All,
I m refering Java Servlet Prog. book of Oreilly , in 2nd chapter there is a example of server side include, it is said to create one .shtml file like this.
---
<html>
<head>
<title>times!</title>
</head>
<body>

the current time here is : <SERVLET CODE=CurrentTime>
If YOU See this SSI is not supported...</servlet>
<P>
The Current Time in LONDON is :
<servlet code=CurrentTime><Param name=zone value=GMT>
If YOU See this SSI is not supported...</servlet>
<P>
The Current Time in NEWYORK is :
<servlet code=CurrentTime><Param name=zone value=EST>
If YOU See this SSI is not supported...</servlet>
<P>
</body>
</html>
----
and a CurrentTime.java file like this:
-----
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class CurrentTime extends HttpServlet{
public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
PrintWriter out = res.getWriter();
Date date = new Date();
DateFormat df = DateFormat.getInstance();
String zone = req.getParameter("zone");
if(zone != null){
TimeZone tz= TimeZone.getTimeZone(zone);
df.setTimeZone(tz);
}
out.println(df.format(date));
out.println("THIS IS THE TIME");
}
}
-----
according to book if i give http://localhost:8080/ssi.shtml
then i will be able to see all three times , but it doesn't work for me, I m using resin1.2.2 webserver but the comment that ssi not supported is displayed..
Please anyone if knowing help me to run the ssi.shtml file..
Thanx in advance
dhaval patel.
 
Consider Paul's rocket mass heater.
 
subject: Server Side Includes.
 
Similar Threads
CAN SHTML files run on Tomcat 3.1, Maha Anna Help
Server-Side Includes
Help:Error with Servlets !!
Problem with SHTML
Weblogic 7.0 supports SSI