What is the use of web.xml and why do we use?
<filter>
<filter-name>wicket.mysticpaste</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>com.mysticcoders.WicketApplication</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>wicket.mysticpaste</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
What does this filer and filermapping do?
This question is related to
java
servlets
jakarta-ee
web.xml
Servlet to be accessible from a browser, then must tell the servlet container what servlets to deploy, and what URL's to map the servlets to. This is done in the web.xml file of your Java web application.
use web.xml in servlet
<servlet>
<description></description>
<display-name>servlet class name</display-name>
<servlet-name>servlet class name</servlet-name>
<servlet-class>servlet package name/servlet class name</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>servlet class name</servlet-name>
<url-pattern>/servlet class name</url-pattern>
</servlet-mapping>
manly use web.xml for servlet mapping.
It's the default configuration for a Java web application; it's required.
WicketFilter
is applied to every HTTP request that's sent to this web app.
Web.xml is called as deployment descriptor file and its is is an XML file that contains information on the configuration of the web application, including the configuration of servlets.
The web.xml
file is the deployment descriptor for a Servlet-based Java web application (which most Java web apps are). Among other things, it declares which Servlets exist and which URLs they handle.
The part you cite defines a Servlet Filter. Servlet filters can do all kinds of preprocessing on requests. Your specific example is a filter had the Wicket framework uses as its entry point for all requests because filters are in some way more powerful than Servlets.
It says all the requests to go through WicketFilter
Also, if you use wicket WicketApplication for application level settings. Like URL patterns and things that are true at app level
This is what you need really, http://wicket.apache.org/learn/examples/helloworld.html
Source: Stackoverflow.com