• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Server-Side Includes

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am trying to run a simple program which uses Server-Side Includes but some how it is not calling servlet program from .shtml file. Please find below a sample code .shtml and servlet code.
Times.shtml
-----------------------------------------------------------------
HTML>
<HEAD><TITLE>Times !!</TITLE></HEAD>
<BODY>
The current time here is:
<SERVLET CODE=CurrentTime>
</SERVLET>
<P>
The current time in London is:
<SERVET CODE=CurrentTime>
<PARAM NAME=zone VALUE=GMT>
</SERVLET>
<P>
The current time in Silicon valley is:
<SERVET CODE=CurrentTime>
<PARAM NAME=zone VALUE=PST>
</SERVLET>
<P>
</BODY>
</HTML>
-----------------------------------------------------------------
CurrentTime.java code
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();
PrintWriter out = new PrintWriter(res.getOutputStream(), true);
Date date = new Date();
DateFormat df = DateFormat.getInstance();
String zone = req.getParameter("zone");
if (zone != null) {
TimeZone tz = TimeZone.getTimeZone(zone);
df.setTimeZone(tz);
}
out.println(df.format(date));
}

-----------------------------------------------------------------


I tried to run test servlet program by entring following values in the browser and it seems to be working OK.

http://localhost:8080/servlet/CurrentTime?zone=EST

I also tested for GMT and PST and values appear to be correct but somehow my .shtml file either does not call this servlet or servlet does not respond to this call.

I am using jswdk-1.0.1 on win98 machine.

Thanks in advance !!

Regards,
Milind

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI
I think that example is from
<font color=red > Servlets by Jason Hunter</font>
In that book ,in first chapters itself he mentioned
that the servletrunner provided along with JSDK
(in your case jswk) won't support all the
functionalities like Servlet chaining , SSI etc.
So you better download java web server or some equivalent.
 
surya sadhu
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI
Please ignore the html tags
 
Ranch Hand
Posts: 2378
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Milind, that Jason's code has caused same problem to me after abt 1 and 1/2 years.... ...like i m crossing time towards back in a time machine...
Does so many days later, Tomcat 4.0.1 still can't solve this problem?
------------------
Muhammad Ashikuzzaman (Fahim)
Sun Certified Programmer for the Java� 2 Platform
--When you learn something, learn it by heart!
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends ,

I spent so much of time on SSI includes , but i am unable to execute it . ...i am getting the same problem as . .milind .. . can somebody help us to get out of this problem , by giving an example or providing an URL

how to work with SSI includes in weblogic or tomcat ?


thanx in advance
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Keep in mind that this thread is 5 years old, you may be better off asking questions like these in a new thread.

Dave.
 
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic