File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes question about SERVLET tag Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "question about SERVLET tag" Watch "question about SERVLET tag" New topic
Author

question about SERVLET tag

rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
I have the following html code:
<HTML>
<HEAD><TITLE>Times!</TITLE></HEAD>
<BODY>
The current time here is"
<SERVLET CODE=servlet/coreservlets.CurrentTime>
</SERVLET>
<P>
The current time in London is:
<SERVLET CODE=servlet/coreservlets.CurrentTime>
<PARAM NAME=zone VALUE=GMT>
</SERVLET>
<P>
And the current time in NEW YORK is:
<SERVLET CODE=servlet/coreservlets.CurrentTime>
<PARAM NAME=zone VALUE=EST>
</SERVLET>
<P>
</BODY>
</HTML>
This file is in: install-dir\webapps\ROOT.
My servlet is in:install_dir\webapps\ROOT\WEB-INF\classes\coreservlets.
coreservlets is a package. When I try to load
the page using: http://local/CurrentTime.html, I cannot get times from my servlet. What is the problem? Thanks.
rick
tony lee
Ranch Hand

Joined: Jan 21, 2002
Posts: 52
hi,
try it by
1) including "package coreservlets;" in the 1st statement of your servlet.
2) adding port # in url http://local:8080/CurrentTime.html


SCJP2, SCWCD
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
SERVLET is not a tag in JSP. Where is this tag defined? I think you are looking for something else. It looks like it's from Marty Hall's site. What example are you trying to follow?
rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
Thanks guys.
Tony, this line was included at the start. This may not be the problem.
I downloaded Jason Hunter's example code, but I am using Tomcat4.0.1, so I just copy the code into my subdirectory. Hunter's code is kind of old now (1998). But I believe SERVLET is a tag.
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
NO, SERVLET is NOT an acceptable tag in JSP. If it's from one of his original books, it was proposed but, never included in the JSP spec. (One of the dangers with writing on proposed drafts) Check out the JSP 1.2 Quick Card and you'll see that SERVLET isn't available.
Now, what is the code like for the servlet/coreservlets.CurrentTime servlet?
rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
I guess this tag was mentioned in JSP's beta version, this is why it disappeared later.
The following is the simple code:
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
The other option is an include tag for an early version of NSAPIor IIAPI for Server Side Includes. I'm not positive which. Well, you can easily refactor this into a JSP Bean to get the output you want. Give it a try and post your code here. I'll work up a result myself and we'll compare results. From there, we can modify it into a JSP TagLib.
Feeling game?
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
<servlet> is not an html tag either.
See the HTML specs here
At one time (I think), there was discussion of a <servlet> html tag, to be used to invoke server side functionality.
The technology/architecture did not work out that way.
Regards, Guy
Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
I think you have it from Jason Hunters 1998 book.
rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
Originally posted by Axel Janssen:
I think you have it from Jason Hunters 1998 book.

Yes, I mentioned in my previous post, Alex.
 
IntelliJ Java IDE
 
subject: question about SERVLET tag
 
Threads others viewed
Help:Error with Servlets !!
Problem with SHTML
Server Side Includes.
Server-Side Includes
CAN SHTML files run on Tomcat 3.1, Maha Anna Help
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com