| Author |
My servlet wont work: Simple answer i expect!
|
Thomas Richards
Greenhorn
Joined: Mar 20, 2005
Posts: 7
|
|
Ok i have my class file i have the directory structure as follows : tomcat- webapps profit WEB-INF (including my index.html) classes(including my web.xml) Profit.class lib So my three files index.html, web.xml and Profit.class are all there and i belive to be in the correct place. If they are in the correct place i expect the answer lies within my xml file: Would this be correct. <web-app> <servlet> <servlet-name>Profit</servlet-name> <servlet-class>Profit.class</servlet-class> </servlet> <servlet-mapping> <url-pattern>/profit</url-pattern> <servlet-name>Profit</servlet-name> </servlet-mapping> </web-app> If you need anymore info please done hesitate to ask. Thanks in advance!
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Files under WEB-INF are hidden from browsers. You shouldn't put the ".class" extension on the filename in the servlet-class attribute. Download and run SimpleServlet from http://simple.souther.us for an example of a properly laid out "Hello, World" servlet app.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56549
|
|
And be aware that the servlet must be in a package other than the default. [ March 20, 2005: Message edited by: Bear Bibeault ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26496
|
|
"Hugogo", We're pleased to have you here with us in the Servlets forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it. In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Thomas Richards
Greenhorn
Joined: Mar 20, 2005
Posts: 7
|
|
Thanks done
|
 |
 |
|
|
subject: My servlet wont work: Simple answer i expect!
|
|
|