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

Struts example source code file (struts-plugin.xml)

This example Struts source code file (struts-plugin.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 - Struts tags/keywords

apache, apache, default, doctype, extension, extension, foundation//dtd, public, software, struts, struts2portletdispatcherservlet, struts2portletdispatcherservlet, utf-8, utf-8

The Struts struts-plugin.xml source code

<?xml version="1.0" encoding="UTF-8" ?>
<!--
/*
 * $Id: struts-plugin.xml 669193 2008-06-18 14:47:55Z hermanns $
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
-->
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
    
<struts>
	
	<bean type="org.apache.struts2.components.UrlRenderer" name="portlet" class="org.apache.struts2.components.PortletUrlRenderer"/>
	
	<constant name="struts.urlRenderer" value="portlet" />
	<constant name="struts.portlet.useDispatcherServlet" value="false" />
	<constant name="struts.portlet.dispatcherServletName" value="Struts2PortletDispatcherServlet" />
	<constant name="struts.objectFactory.spring.autoWire.alwaysRespect" value="false" />

    <package name="struts-portlet-default" extends="struts-default">

	   <result-types>
			<result-type name="dispatcher" class="org.apache.struts2.portlet.result.PortletResult" default="true"/>
            <result-type name="redirect" class="org.apache.struts2.portlet.result.PortletResult"/>
		    <result-type name="redirectAction" class="org.apache.struts2.portlet.result.PortletActionRedirectResult"/>
			<result-type name="freemarker" class="org.apache.struts2.views.freemarker.PortletFreemarkerResult"/>
			<result-type name="velocity" class="org.apache.struts2.portlet.result.PortletVelocityResult"/>
	   </result-types>
       
       <interceptors>
        <interceptor name="portletAware" class="org.apache.struts2.portlet.interceptor.PortletAwareInterceptor"/>
		<interceptor name="portletState" class="org.apache.struts2.portlet.interceptor.PortletStateInterceptor"/>
		<!-- Default stack for operating in portlet environment -->
        <interceptor-stack name="portletDefaultStack">
			<interceptor-ref name="portletState"/>
            <interceptor-ref name="portletAware"/>
            <interceptor-ref name="defaultStack"/>
        </interceptor-stack>
        <!-- Extension of the default portlet stack which also includes the token interceptor --> 
		<interceptor-stack name="portletDefaultStackWithToken">
			<interceptor-ref name="portletState"/>
			<interceptor-ref name="portletAware"/>
			<interceptor-ref name="token"/>
			<interceptor-ref name="defaultStack"/>
		</interceptor-stack>
		   
       </interceptors>
       
       <default-interceptor-ref name="portletDefaultStack"/>
		
	   <action name="renderDirect" class="org.apache.struts2.portlet.dispatcher.DirectRenderFromEventAction">
	   		<result name="success">${location}
	   </action>
	   <action name="freemarkerDirect" class="org.apache.struts2.portlet.dispatcher.DirectRenderFromEventAction">
	   		<result type="freemarker" name="success">${location}
	   </action>
	   <action name="velocityDirect" class="org.apache.struts2.portlet.dispatcher.DirectRenderFromEventAction">
	   		<result type="velocity" name="success">${location}
	   </action>
	</package>
</struts>

Other Struts examples (source code examples)

Here is a short list of links related to this Struts struts-plugin.xml source code file:

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

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 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.