Exception starting filter struts2 – tried adding JAR’s, but same result

Since you are using Struts 2.3, FilterDispatcher is deprecated. You MUST use StrutsPrepareAndExecuteFilter (or its little brothers). From the official documentation Deprecated. Since Struts 2.1.3, use StrutsPrepareAndExecuteFilter instead or StrutsPrepareFilter and StrutsExecuteFilter if needing using the ActionContextCleanUp filter in addition to this one change then this <!– Struts < 2.1.3 –> <filter-class> org.apache.struts2.dispatcher.FilterDispatcher </filter-class> to … Read more

Loading context in Spring using web.xml

From the spring docs Spring can be easily integrated into any Java-based web framework. All you need to do is to declare the ContextLoaderListener in your web.xml and use a contextConfigLocation to set which context files to load. The <context-param>: <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext*.xml</param-value> </context-param> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> You can then use the WebApplicationContext … Read more

java.lang.IllegalArgumentException: Invalid in servlet mapping

<url-pattern>*NEXTEVENT*</url-pattern> The URL pattern is not valid. It can either end in an asterisk or start with one (to denote a file extension mapping). The url-pattern specification: A string beginning with a ‘/’ character and ending with a ‘/*’ suffix is used for path mapping. A string beginning with a ‘*.’ prefix is used as … Read more

How to define servlet filter order of execution using annotations in WAR

You can indeed not define the filter execution order using @WebFilter annotation. However, to minimize the web.xml usage, it’s sufficient to annotate all filters with just a filterName so that you don’t need the <filter> definition, but just a <filter-mapping> definition in the desired order. For example, @WebFilter(filterName=”filter1″) public class Filter1 implements Filter {} @WebFilter(filterName=”filter2″) … Read more

No WebApplicationContext found: no ContextLoaderListener registered?

You’ll have to have a ContextLoaderListener in your web.xml – It loads your configuration files. <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> You need to understand the difference between Web application context and root application context . In the web MVC framework, each DispatcherServlet has its own WebApplicationContext, which inherits all the beans already defined in the root WebApplicationContext. … Read more

What is the significance of url-pattern in web.xml and how to configure servlet?

url-pattern is used in web.xml to map your servlet to specific URL. Please see below xml code, similar code you may find in your web.xml configuration file. <servlet> <servlet-name>AddPhotoServlet</servlet-name> //servlet name <servlet-class>upload.AddPhotoServlet</servlet-class> //servlet class </servlet> <servlet-mapping> <servlet-name>AddPhotoServlet</servlet-name> //servlet name <url-pattern>/AddPhotoServlet</url-pattern> //how it should appear </servlet-mapping> If you change url-pattern of AddPhotoServlet from /AddPhotoServlet to /MyUrl. … Read more

EL expressions not evaluated in JSP

Yes, i have doctype in web.xml <!DOCTYPE web-app PUBLIC “-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN” “java.sun.com/dtd/web-app_2_3.dtd”; > Remove that <!DOCTYPE> from web.xml and make sure that the <web-app> is declared conform Servlet 2.4 or newer and all should be well. A valid Servlet 3.0 (Tomcat 7, JBoss AS 6-7, GlassFish 3, etc) compatible web.xml look … Read more

How to specify the default error page in web.xml?

On Servlet 3.0 or newer you could just specify <web-app …> <error-page> <location>/general-error.html</location> </error-page> </web-app> But as you’re still on Servlet 2.5, there’s no other way than specifying every common HTTP error individually. You need to figure which HTTP errors the enduser could possibly face. On a barebones webapp with for example the usage of … Read more