I tried this like this and it is working .See if it
is useful for you

                        CurrentTime.html file is this

                        <pre>
                        <html>
                        <head><title>Times!</title></head>
                        <body>
                        <form id=time name=time method=get
action=http://localhost:8080/examples/servlet/CurrentTime>
                        Enter time zone here<INPUT type="text" id=zone
name=zone>
                        <BR>
                        <INPUT type="submit" value="Time is" id=submit1
name=submit1>
                        </form>
                        </body>
                        </html>
                        <pre>

                        And CurrentTime.java file 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));
                                }
                        }


                                -----Original Message-----
                                From:   Anup Kumar M A
[mailto:[EMAIL PROTECTED]]
                                Sent:   Monday, May 15, 2000 11:19 AM
                                To:     [EMAIL PROTECTED]
                                Subject:        Problem in serversideinclude

                                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

___________________________________________________________________________
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