• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Problem with SHTML  RSS feed

Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem while making a simple SSI. I call a dateservlet in my SHTML to show different time zones. But the problem is that once I pass a parameter the time is set for that particular Zone and it does not change. That seems strange. Could anybody explain it ?
this example is from Orelliy's Servlet book :
The code for SHTML is :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>Server Sider Include Example</title>

<h1>The plain Time is....</h1>
<h1>The PST Time is...............</h1>
<SERVLET code=DateSsi >

<h1>The GMT Time is....</h1>
<h1>The CET Time is....</h1>

The servlet code is
import java.io.*;
import java.util.*;
import java.text.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class DateSsi extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException,IOException {

PrintWriter out = res.getWriter();

Date dt = new Date();

DateFormat df=DateFormat.getInstance();

String zone1 = req.getParameter("zone");

if ( zone1 != null ) {
TimeZone tz= TimeZone.getTimeZone(zone1);

out.println("the zone is" + zone1 + "<br><br>");
out.println("<br>The Time is :" + df.format(dt) + "......");

The output looks like this when I invoke the SHTML in JWS2.0
The plain Time is....
the zone isnull

The Time is :2000-11-22 10:05......
The PST Time is...............
the zone isCET

The Time is :2000-11-22 09:05......

The GMT Time is....
the zone isCET

The Time is :2000-11-22 09:05......

The CET Time is....
the zone isCET

The Time is :2000-11-22 09:05......
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!