alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Spring Framework example source code file (web.xml)

This example Spring Framework source code file (web.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Spring Framework tags/keywords

applied, applied, contextloaderservlet, location, log4j, log4j, log4jconfiglistener, petportal, portlet, portlet, spring, the, the, this

The Spring Framework web.xml source code

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

	<display-name>Spring PetPortal

	<description>Spring Portlet MVC PetPortal sample application

	<!--
		- Key of the system property that should specify the root directory of this
		- web app. Applied by WebAppRootListener or Log4jConfigListener.
	-->
	<context-param>
		<param-name>webAppRootKey
		<param-value>petportal.root
	</context-param>

	<!--
		- Location of the Log4J config file, for initialization and refresh checks.
		- Applied by Log4jConfigListener.
	-->
	<context-param>
		<param-name>log4jConfigLocation
		<param-value>/WEB-INF/log4j.properties
	</context-param>

	<!--
		- Location of the XML file that defines the root application context.
		- Applied by ContextLoaderServlet.
	-->
	<context-param>
		<param-name>contextConfigLocation
		<param-value>/WEB-INF/context/common.xml
	</context-param>

	<!--
		- Configures Log4J for this web app.
		- As this context specifies a context-param "log4jConfigLocation", its file path
		- is used to load the Log4J configuration, including periodic refresh checks.
		-
		- Would fall back to default Log4J initialization (non-refreshing) if no special
		- context-params are given.
		-
		- Exports a "web app root key", i.e. a system property that specifies the root
		- directory of this web app, for usage in log file paths.
		- This web app specifies "petportal.root" (see log4j.properties file).
	-->
	<listener>
		<listener-class>org.springframework.web.util.Log4jConfigListener
	</listener>

	<!--
		- Loads the root application context of this web app at startup,
		- by default from "/WEB-INF/applicationContext.xml".
		- Note that you need to fall back to Spring's ContextLoaderServlet for
		- J2EE servers that do not follow the Servlet 2.4 initialization order.
		-
		- Use WebApplicationContextUtils.getWebApplicationContext(servletContext)
		- to access it anywhere in the web application, outside of the framework.
		-
		- The root context is the parent of all servlet-specific contexts.
		- This means that its beans are automatically available in these child contexts,
		- both for getBean(name) calls and (external) bean references.
	-->
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener
	</listener>

	<!--
		- The ViewRendererServlet acts as a bridge from Portlet requests to Servlet requests.
		- Thus a Spring Portlet is able to leverage Spring MVC's view rendering capabilities.
	-->
	<servlet>
		<servlet-name>view-servlet
		<servlet-class>org.springframework.web.servlet.ViewRendererServlet
		<load-on-startup>1
	</servlet>

	<servlet-mapping>
		<servlet-name>view-servlet
		<url-pattern>/WEB-INF/servlet/view
	</servlet-mapping>

</web-app>

Other Spring Framework examples (source code examples)

Here is a short list of links related to this Spring Framework web.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.