Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8534057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:06:26+00:00 2026-06-11T10:06:26+00:00

I am having this question can we specify the servlet path in the servlet

  • 0

I am having this question can we specify the servlet path in the servlet itself something like

(path = /myServlet)
public MyNormalServlet extends HttpServlet….{
.
.
.
}

So If call from browser say “http://localhost:8080/myServlet”
this servlet of mine will get called and it would also be an independent servlet in tomcat whose mapping cant be specified in tomcat’s web.xml

Please if can anyone help me with this and provide the possible solution for it..

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:06:27+00:00Added an answer on June 11, 2026 at 10:06 am

    If you are running Tomcat, just edit the web.xml file:

    (...)
    <servlet>
        <servlet-name>TestingServlet</servlet-name>
        <servlet-class>TestingServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>TestingServlet</servlet-name>
        <url-pattern>/servlet/TestingServlet</url-pattern>
    </servlet-mapping>
    (...)
    

    Where:
    … the name of your servlet. It can be anything you want, it just must match the inside the servlet-mapping
    …the name of the class that will handle this servlet.

    … anything you want, as long as it matches the same tag on
    … the url path you want to respond to.. So in your example you would type ‘/myServlet’ here

    If you want to read more on the subject: http://javapapers.com/servlet/what-is-servlet-mapping/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple question. Just wondering if this can be done without me having to enforce
edit This question is solved! Having something weird. I'm using html { font-size: 100%
This might seem like a pretty detailed question about Easymock, but I'm having a
Having read this question Immutable or not immutable? and reading answers to my previous
I'm having trouble understanding this question, and the explanation of the answer for an
After googling and landing on SO and having read this other question Is it
For this question, we want to avoid having to write a special query since
I'm having the same problem as this question . I tried installing the libcairo
I am having the same issues as per this question: WCF not deserializing JSON
I was having a look at this question: Getting random value from a SQLite

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.