Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!

Dave Thomas

Ranch Hand
+ Follow
since Nov 05, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dave Thomas

Do I have to declare every servlet explicitly in web.xml. I am currently trying to invoke it using the url: http://localhost:8082/mytest/servlet/TestServlet
and i am getting the old 404 page. It works fine however if i use a mapping in web.xml. I must have done something wrong somewhere.
Thanks
17 years ago
Sorry but I don't think that's right. Sure you wont see the output in the browser but the question asks if it will be visible in the source code (Edit menu > view source). It is. Just to make sure I tested it - without setting the content-type - and it is.
Actually I think you will see the output and the date will be evaluated - These (<!--) are just html comments. "<%--" will prevent the line being displayed "in the source code"
Coud someone tell me if there are any circumstances other than the following when contextInitialized(event) would be called:
1. Web Server starts
2. An updated class file is added to the application and the web server detects it
Hi. Both the explanation and answer are right. Declaring "isThreadSafe = false" means that the developer has not taken any action to make it threadsafe and so SingleThreadModel is implemented
The new board looks great and has the old search engine that is so easy to use. When can we expect the change over - if at all?
18 years ago
Cool. Thanks. Thats all I needed to know.
Hi all. I got this question from www.jdiscuss.com. I am a bit confused.
Question No: 5 (Question ID: 796)

Problem

Consider the following code:
public class WWServlet extends HttpServlet
{
....
}
What methods do you need to implement so that it compiles without any errors?


Options

Select 1 correct option.

A service()

B doService()

C doGet

D all doXXX methods

E No method as HttpServlet has dummy implementations.


Answer E
Reason:
GenericServlet has an abstract service(ServletRequest, ServletResponse)
method. HttpServlet extends GenericServlet and provides a concrete
implementation of the service() method. It also provides the empty
implementation for the doXXX() methods.
But the API says:
Provides an abstract class to be subclassed to create an HTTP servlet
suitable for a Web site. A subclass of HttpServlet must override at
least one method, usually one of these:
doGet, if the servlet supports HTTP GET requests
doPost, for HTTP POST requests
doPut, for HTTP PUT requests
doDelete, for HTTP DELETE requests
init and destroy, to manage resources that are held for the life of the servlet
getServletInfo, which the servlet uses to provide information about itself


Is the answer E because the API is only saying you HAVE to override one
of these to provide functionality, not to allow compilation? I dunno. Can
anyone tell me?
A declaration has instance scope. What is the scope of a varuable declared in a sciptlet?
In case anyone is interested I found the problem.
I changed my DTD to this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">;
and removed <description> and <display-name> tags.
Also, the listener tags must come before the servlet tags.
18 years ago
Hi all.
I have created a ServletContextListener and placed it in my classes directory. I have added the entry into the deployment descriptor but am getting the error message:
PARSE error at line 7 column 14
org.xml.sax.SAXParseException: Element type "listener" must be declared.
Heres mt descriptor code:
<listener>
<listener-class>DBContextListener</listener-class>
</listener>
Any ideas?
Thanks in advance
Oh yeah. I am using Tomcat
[ June 04, 2002: Message edited by: Caveman Thomas ]
18 years ago
Which directory can I put a war file using Oracle 8i... or even better where can I put the unjarred directory structure... Or can't I? Seems not to be as simple as Tomcat (although that only seems simple now... hehe)
18 years ago
So when I initialise the directories with my init - param, I just append those directories to the filename I need when accessing it? Is the working directory you specify just on the drive outside the web application or can it be in the web application directory structure itself?
[ March 27, 2002: Message edited by: Caveman Thomas ]
18 years ago
Hi there,
I have a helper class in a directory classes\utilities and I would like it to be able to read a text file - (to access the driver name, connectionURL, etc for a database). Problem is, I'm getting a FileNotFoundException. I've placed the file under the utitlities directory, classes, and public but still no access. I'm refering to the file as simply "fileName" which I suspect may be the problem ... but then what do I know? I'm the one with the problem here. Any ideas would be greatly appreciated.
18 years ago
I guess thats my point Rob. Since most computers on a network, even if there were 50 million of them, would most likely be behind a proxy requiring only one IP address for each proxy, it would seem unlikely that even the largest company / government / whatever in the world would need a class A licence. The only reason I could come up with is that you might like to rent / sell them to make money like an ISP perhaps, but they aren't the ones who have them. Perhaps class A addresses were really cheap when they first came out. Were proxies around when the Internet first started?
18 years ago