hi
i am having a problem in Server Side Include
i posted this a few days back, but didn't get any replies.
so i am posting it again
I am using a .shtml file having three server side includes to the same
servlet but passing different parameters.
This program was taken from Jason Hunter's book on Servlet programming.
The .shtml file is this
<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>
</body>
</html>
The servlet is 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();
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 PST date and time for all the
three(Current,London &New York).That is req.getParameter("zone") is always
returning PST for all the three includes. thanks
Anup
___________________________________________________________________________
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