Solved

How to make a servlet "default page" in Tomca

Posted on 2002-06-07
4
227 Views
Last Modified: 2013-11-24

I want "www.mydomain.com" to invoke one of servlets,
which means a servlet is my dafaut page.
Conventionally, servlet is invoked by calling
www.mycomain.com/servlet/MyServlet.
Does anybody know how to configure??
I am using Tomcat only. I can use Apache if needed.
Please help.
0
Comment
Question by:jhy
  • 2
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 200 total points
Comment Utility
in your web.xml put something like this:
    <servlet>
        <servlet-name>
            MyServlet
        </servlet-name>
        <servlet-class>
            com.package.MyServlet        
        </servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>
            MyServlet
        </servlet-name>
        <url-pattern>
            index.html
        </url-pattern>
    </servlet-mapping>
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
 It depends on what version of tomcat you are using. I am not sure about the latest Cataline one but in the older versions you can define it in your web.xml file:

<welcome-file-list>
    <welcome-file>default.html</welcome-file>
</welcome-file-list>

  You can redirect to the servlet from your default file.

  Additionally you can also use the <servlet-mapping> tag, but I have not used Tomcat for ages, so someone else might be able to help you more.

  Hope it helps.
0
 
LVL 18

Expert Comment

by:bobbit31
Comment Utility
the servlet mapping works on both tomcat 3.2.* and tomcat 4.0
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
 I see... I have not used Tomcat since its 3.2 version... I know that Catalina is a completely new architecture so I was not sure if the <servlet-mapping> and <servlet> still work the same. To be honest I am not 100% sure even for the <welcome-file-list>.

  Kind regards
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
scoresSpecial  challenge 13 40
bigHeights  challenge 13 55
changePi Challenge 15 75
computer science syllabus 3 52
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now