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 8298401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:45:31+00:00 2026-06-08T15:45:31+00:00

I am starting to learn Struts 2. I stumbled upon this code: web.xml …some

  • 0

I am starting to learn Struts 2. I stumbled upon this code:

web.xml

...some other codes...

<filter>
    <filter-name>MyFilter</filter-name>
    <display-name>MyFilter</display-name>
    <filter-class>com.xxx.yyy.zzz.MyFilter</filter-class>
</filter>

<filter-mapping>
   <filter-name>MyFilter</filter-name>
   <servlet-name>MyAction</servlet-name>
</filter-mapping>

<listener>
   <listener-class>com.xxx.yyy.StrutsListener</listener-class>
</listener> 

<servlet>
    <servlet-name>MyAction</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
        <param-name>paramName1param-name>
        <param-value>paramVal1</param-value>
    </init-param>
    <init-param>
        <param-name>paramName2</param-name>
        <param-value>paramVal2</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

...some other codes...

My question is in this part

 <filter-mapping>
      <filter-name>MyFilter</filter-name>
      <servlet-name>MyAction</servlet-name>
 </filter-mapping>

Why is it a servlet being mapped inside a <filter-mapping> tag? What does this kind of mapping imply? Also, what does <listener> do? Thanks for the replies.

  • 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-08T15:45:33+00:00Added an answer on June 8, 2026 at 3:45 pm

    Have you tried Google ?

    Why is it a servlet being mapped inside a tag? What does this kind of
    mapping imply?

    Read this: http://docs.oracle.com/cd/E13222_01/wls/docs81/webapp/web_xml.html#1039330

    what does <listener> do?

    http://docs.oracle.com/cd/E13222_01/wls/docs81/webapp/web_xml.html#1039300

    Example: http://tomcat-configure.blogspot.in/2009/01/tomcat-context-listener-example.html

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

Sidebar

Related Questions

I'm starting learn some web programming and picked up knockout.js because the MVVM pattern
I'm starting to learn OOP in JS and I came across this issue where
I've been starting to learn Struts 2 over the past week or so and
I'm just starting to learn about jQuery. I'm more of a html+css web designer
I'm just starting to learn JavaScript, and stumbled over Underscore.js and jQuery . Underscore
Hi just starting to learn this language, more of a javascript/PHP guy... I can't
Just starting to learn some basic C and messing around with the stat() system
I am just starting to learn jQuery and have gotten some of the basic
Im starting to learn a bit of xml and xslt, and I read on
I'm starting to learn and practice some CoreData, with no programming experience. After searching

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.