I got one problem in Server Side
Include::
...when i used SERVLET tag in HTML , i'm
just
able to display some output(of the servlet
programme)
on the page...but if i want to insert that output of servlet
programme into some INPUT element of
Html-form...it
does not work......
following is the code for servlet(.java)..for
getting date-time...
public class CurrentTime extends
HttpServlet
{
String date = new String();
public void doGet(HttpServletRequest
req , HttpServletResponse
res)
throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
Date dt =
new Date();
DateFormat df =
DateFormat.getInstance();
String
zone=req.getParameter("zone");
if(zone !=
null)
{ TimeZone tz =
TimeZone.getTimeZone(zone);
df.setTimeZone(tz);
}
date =
df.format(dt);
out.println(df.format(dt));
/* i tried to use
these lines to store date value but didn't work......
// out.println("<input type=text name=name
value=BHAGALPUR>");
// out.println("<input type=text name=D1
value="+ date + ">");
}
}
************************************
and this is the code for .shtml (kept in
c:\javawebserver2.0\public_html\rtime.shtml)
<html>
<head><title>Times!</title><meta
name="Microsoft Theme" content="global 101, default"><meta
name="Microsoft Border" content="tl, default"></head>
<body
background="_themes/global/glotextb.gif" bgcolor="#FFFFCC" text="#510000"
link="#999900" vlink="#CC9966"
alink="#990066"><!--msnavigation--><table border="0"
cellpadding="0" cellspacing="0"
width="100%"><tr><td><!--mstheme--><font face="arial,
helvetica">
<p align="center"><font
size="6"><strong></strong></font><br>
</p>
<p
align="center"> </p>
<!--mstheme--></font></td></tr><!--msnavigation--></table><!--msnavigation--><table
border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td
valign="top" width="1%"><!--mstheme--><font face="arial,
helvetica">
<!--mstheme--></font></td><td valign="top"
width="24"></td><!--msnavigation--><td
valign="top"><!--mstheme--><font face="arial,
helvetica">
<form>
<p>
Current Local Date is
::
<servlet code="CurrentTime">
DOES NOT SUPPORT
SSI
</servlet>
</p>
The Current Time in London
is::
<servlet code="CurrentTime">
<param name="zone"
value="GMT">
DOES NOT SUPPORT SSI
22
</servlet>
<p>
</form>
<!--mstheme--></font><!--msnavigation--></td></tr><!--msnavigation--></table></body>
</html>
.........CAN ANYBODY PLEASE HELP that
instead of just displaying Date-Time on the
page....how to store date and time into some
variable(ie to some INPUT tag of
html.....????