how to address servlets?

I installed tomcat 5.0.27.

and make a immedate child folder "sqi" under webapp.

in the sqi folder, there are

WEB-INF - classes - LoginServlet.class
        - web.xml
the server.xml file is as the same when installed.
and the web.xml file looks like;

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

  <display-name>Java Test Example</display-name>
     Java Test Example

when I type "http://localhost/sqi/login.html" in the address bar, it works ok.

I don't know how to code in action attribute value in the login.html page.
/servlet/LoginServlet, LoginServlet, none of them works.

how can I address the servlet?

do you know some useful info how to configure web.xml and servlet.xml files?

Who is Participating?
yuvalgConnect With a Mentor Commented:
Glad to see its working.

Anyways, you HAVE TO have every servlet in web.xml, the only optional part is using the servlet-mapping.

Using servlet-mapping is the natural way to do what you want.
But, if you insist on using a new default you can do some URL rewriting with an apache web-server infront of your server. The server infront will receive a call for a url like http://sitename/thisServlet and will route it to http://sitename/servlet/thisServlet.

like i said before, i think the servlet-mapping is a valid option.

I hope this helps.

You need to add a servlet-mapping part that maps your Servlet to a url pattern you would wish to use (thats in web.xml)

Otherwise, i think the default is /servlet/<your_servlet >

for example:

 If  You already have this set:

You need to add this clause:


iamjhkangAuthor Commented:
Yes. It works.
then do I have to add all servlets to web.xml?
isn't there a way, for example, /servlet/* other than adding every servlet to web.xml?

iamjhkangAuthor Commented:
do you have any articles on the configuration of web.xml or server.xml?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.