Thanks so much for those answers.
Richard, I've put the class in a package and included the <servlet-mapping>, like you and Nidhi said I should.
And William, I read
The Long and Sordid Tale of the Invoker Servlet
you linked me to and I got the message.
I think I've got it now, only that the page that comes up is blank.
First, I did as the FAQ page said at the begining of the page:
In the file conf/web.xml find a section of text that looks like this:
<!-- The mapping for the invoker servlet -->
<!--
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
-->
[/code]
You need to uncomment the servlet-mapping and then restart Tomcat. Your application should work now....
I uncommented these lines.
I did this just to see the application work, at least. But knew something was wrong when instead of displaying a webpage, I got a text file downloaded. Then saw it was in the part where the servlet sends the header [code] theResponse.setContentType("text.html"); [/code] . I fixed that to read [code] theResponse.setContentType("text/html"); [/code]. Then I put the servlet in a package named mypackage ( I always prefer to keep things simple at first. The package structure could get deeper later), and I added the <servlet-mapping> tag. But all I get now is a blank page. What am I doing wrong?
In a bid to solve this, I included my classes directory in the classpath. Still didn't work. I then chaged the way output is sent to the browser in the servlet, like this
[code]
ServletOutputStream out = theResponse.getOutputStream();
out.println("<HTML>");
[/code]
I think it's something to do with my web.xml file.
Listing of my web.xml file:
[code]
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2se/dtds/web-app_2_2.dtd">
<web-app>
<!-- Application that implements Wireless security for GSM networks in this case, Nigeria -->
<display-name>Wireless Security application</display-name>
<description>
This application uses a client - server model to implement a Wireless security mechanism for
GSM networks.
</description>
<!--
I'm supposed to declare parameters here, but chose not to, yet
-->
<context-param>
<param-name>myParameter</param-name>
<param-value>myValue</param-value>
<description>
This parameter represents nothing sensible......
</description>
</context-param>
<servlet>
<servlet-name>HelloServlet</servlet-name>
<description>
This servlet does this and this.....
</description>
<servlet-class>mypackage.HelloServlet</servlet-class>
<init-param>
<param-name>NoParameter</param-name>
<param-value>NoValue</param-value>
</init-param>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/gsm</url-pattern>
</servlet-mapping>
<session-config>
<!-- How long to wait before the session times out-->
<!-- 30 minutes -->
<session-timeout>30</session-timeout>
</session-config>
</web-app>
[/code]
Any useful suggestion would be greatly appreaciated.
Thanks.