i am trying to run a ServerSideInclude with JavaWebserver 2.0
the code goes like this
the html file named ssi.shtml
<pre>
<html>
<head><title>Times!</title></head>
<body>
The current time here is
<servlet code=time>
<Param name=zone value=PST>
</servlet>
<p>
The current time in London is:
<servlet code=time>
<Param name=zone value=GMT>
</servlet>
<p>
The current time in NewYork is:
<servlet code=time >
<Param name=zone value=EST>
</servlet>
</p>
</body>
</html>
<pre>
the code for the servlet, the servlet is registered with the name "time"
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();
  String zone=req.getParameter("zone");
  DateFormat df=DateFormat.getInstance();

  if(zone!=null){
   TimeZone tz=TimeZone.getTimeZone(zone);
   df.setTimeZone(tz);
  }

  out.println(df.format(date));
  }
}

The problem is I am always getting the first value of parameter zone ie;PST
so that all the times are same.
The browser output is this

The current time here is 5/14/00 10:48 PM
The current time in London is: 5/14/00 10:48 PM
The current time in NewYork is: 5/14/00 10:48 PM
what could be the reason?
Anup Kumar M.A.
Trigent Software

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to