SPR-6236: Reintroduce Struts support

This commit is contained in:
Arjen Poutsma
2009-10-15 10:31:47 +00:00
parent e24e768054
commit 7fa9105096
33 changed files with 3931 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
/*
* Copyright 2002-2005 the original author or authors.
*
* Licensed 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.
*/
package org.springframework.web.servlet.view.tiles;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.tiles.ComponentContext;
/**
* @author Juergen Hoeller
* @since 22.08.2003
*/
public class TestComponentController extends ComponentControllerSupport {
@Override
protected void doPerform(ComponentContext componentContext, HttpServletRequest request, HttpServletResponse response) {
request.setAttribute("testAttr", "testVal");
TilesView.setPath(request, "/WEB-INF/jsp/layout.jsp");
}
}

View File

@@ -0,0 +1,181 @@
/*
* Copyright 2002-2008 the original author or authors.
*
* Licensed 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.
*/
package org.springframework.web.servlet.view.tiles;
import java.util.HashMap;
import java.util.Locale;
import javax.servlet.jsp.jstl.core.Config;
import javax.servlet.jsp.jstl.fmt.LocalizationContext;
import org.apache.struts.taglib.tiles.ComponentConstants;
import org.apache.struts.tiles.ComponentContext;
import org.apache.struts.tiles.PathAttribute;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.StaticWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver;
import org.springframework.web.servlet.i18n.FixedLocaleResolver;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
/**
* @author Alef Arendsen
* @author Juergen Hoeller
*/
public class TilesViewTests {
protected StaticWebApplicationContext prepareWebApplicationContext() throws Exception {
StaticWebApplicationContext wac = new StaticWebApplicationContext();
MockServletContext sc = new MockServletContext("/org/springframework/web/servlet/view/tiles/");
wac.setServletContext(sc);
wac.refresh();
TilesConfigurer tc = new TilesConfigurer();
tc.setDefinitions(new String[] {"tiles-test.xml"});
tc.setValidateDefinitions(true);
tc.setApplicationContext(wac);
tc.afterPropertiesSet();
return wac;
}
@Test
public void tilesView() throws Exception {
WebApplicationContext wac = prepareWebApplicationContext();
InternalResourceViewResolver irvr = new InternalResourceViewResolver();
irvr.setApplicationContext(wac);
irvr.setViewClass(TilesView.class);
View view = irvr.resolveViewName("testTile", new Locale("nl", ""));
MockHttpServletRequest request = new MockHttpServletRequest(wac.getServletContext());
MockHttpServletResponse response = new MockHttpServletResponse();
request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, new AcceptHeaderLocaleResolver());
view.render(new HashMap<String, Object>(), request, response);
assertEquals("/WEB-INF/jsp/layout.jsp", response.getForwardedUrl());
ComponentContext cc = (ComponentContext) request.getAttribute(ComponentConstants.COMPONENT_CONTEXT);
assertNotNull(cc);
PathAttribute attr = (PathAttribute) cc.getAttribute("content");
assertEquals("/WEB-INF/jsp/content.jsp", attr.getValue());
view.render(new HashMap<String, Object>(), request, response);
assertEquals("/WEB-INF/jsp/layout.jsp", response.getForwardedUrl());
cc = (ComponentContext) request.getAttribute(ComponentConstants.COMPONENT_CONTEXT);
assertNotNull(cc);
attr = (PathAttribute) cc.getAttribute("content");
assertEquals("/WEB-INF/jsp/content.jsp", attr.getValue());
}
@Test
public void tilesJstlView() throws Exception {
Locale locale = !Locale.GERMAN.equals(Locale.getDefault()) ? Locale.GERMAN : Locale.FRENCH;
StaticWebApplicationContext wac = prepareWebApplicationContext();
InternalResourceViewResolver irvr = new InternalResourceViewResolver();
irvr.setApplicationContext(wac);
irvr.setViewClass(TilesJstlView.class);
View view = irvr.resolveViewName("testTile", new Locale("nl", ""));
MockHttpServletRequest request = new MockHttpServletRequest(wac.getServletContext());
MockHttpServletResponse response = new MockHttpServletResponse();
request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, new FixedLocaleResolver(locale));
wac.addMessage("code1", locale, "messageX");
view.render(new HashMap<String, Object>(), request, response);
assertEquals("/WEB-INF/jsp/layout.jsp", response.getForwardedUrl());
ComponentContext cc = (ComponentContext) request.getAttribute(ComponentConstants.COMPONENT_CONTEXT);
assertNotNull(cc);
PathAttribute attr = (PathAttribute) cc.getAttribute("content");
assertEquals("/WEB-INF/jsp/content.jsp", attr.getValue());
assertEquals(locale, Config.get(request, Config.FMT_LOCALE));
LocalizationContext lc = (LocalizationContext) Config.get(request, Config.FMT_LOCALIZATION_CONTEXT);
assertEquals("messageX", lc.getResourceBundle().getString("code1"));
}
@Test
public void tilesJstlViewWithContextParam() throws Exception {
Locale locale = !Locale.GERMAN.equals(Locale.getDefault()) ? Locale.GERMAN : Locale.FRENCH;
StaticWebApplicationContext wac = prepareWebApplicationContext();
((MockServletContext) wac.getServletContext()).addInitParameter(
Config.FMT_LOCALIZATION_CONTEXT, "org/springframework/web/servlet/view/tiles/context-messages");
InternalResourceViewResolver irvr = new InternalResourceViewResolver();
irvr.setApplicationContext(wac);
irvr.setViewClass(TilesJstlView.class);
View view = irvr.resolveViewName("testTile", new Locale("nl", ""));
MockHttpServletRequest request = new MockHttpServletRequest(wac.getServletContext());
MockHttpServletResponse response = new MockHttpServletResponse();
wac.addMessage("code1", locale, "messageX");
request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, new FixedLocaleResolver(locale));
view.render(new HashMap<String, Object>(), request, response);
assertEquals("/WEB-INF/jsp/layout.jsp", response.getForwardedUrl());
ComponentContext cc = (ComponentContext) request.getAttribute(ComponentConstants.COMPONENT_CONTEXT);
assertNotNull(cc);
PathAttribute attr = (PathAttribute) cc.getAttribute("content");
assertEquals("/WEB-INF/jsp/content.jsp", attr.getValue());
LocalizationContext lc = (LocalizationContext) Config.get(request, Config.FMT_LOCALIZATION_CONTEXT);
assertEquals("message1", lc.getResourceBundle().getString("code1"));
assertEquals("message2", lc.getResourceBundle().getString("code2"));
}
@Test
public void tilesViewWithController() throws Exception {
WebApplicationContext wac = prepareWebApplicationContext();
InternalResourceViewResolver irvr = new InternalResourceViewResolver();
irvr.setApplicationContext(wac);
irvr.setViewClass(TilesView.class);
View view = irvr.resolveViewName("testTileWithController", new Locale("nl", ""));
MockHttpServletRequest request = new MockHttpServletRequest(wac.getServletContext());
MockHttpServletResponse response = new MockHttpServletResponse();
request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, new AcceptHeaderLocaleResolver());
view.render(new HashMap<String, Object>(), request, response);
assertEquals("/WEB-INF/jsp/layout.jsp", response.getForwardedUrl());
ComponentContext cc = (ComponentContext) request.getAttribute(ComponentConstants.COMPONENT_CONTEXT);
assertNotNull(cc);
PathAttribute attr = (PathAttribute) cc.getAttribute("content");
assertEquals("/WEB-INF/jsp/otherContent.jsp", attr.getValue());
assertEquals("testVal", request.getAttribute("testAttr"));
view.render(new HashMap<String, Object>(), request, response);
assertEquals("/WEB-INF/jsp/layout.jsp", response.getForwardedUrl());
cc = (ComponentContext) request.getAttribute(ComponentConstants.COMPONENT_CONTEXT);
assertNotNull(cc);
attr = (PathAttribute) cc.getAttribute("content");
assertEquals("/WEB-INF/jsp/otherContent.jsp", attr.getValue());
assertEquals("testVal", request.getAttribute("testAttr"));
}
}

View File

@@ -0,0 +1,337 @@
/*
* Copyright 2002-2005 the original author or authors.
*
* Licensed 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.
*/
package org.springframework.web.struts;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.config.ModuleConfig;
import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.StaticWebApplicationContext;
/**
* @author Juergen Hoeller
* @since 09.04.2004
*/
public class StrutsSupportTests {
@Test
public void actionSupportWithContextLoaderPlugIn() throws ServletException {
StaticWebApplicationContext wac = new StaticWebApplicationContext();
wac.addMessage("test", Locale.getDefault(), "testmessage");
final ServletContext servletContext = new MockServletContext();
wac.setServletContext(servletContext);
wac.refresh();
servletContext.setAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX, wac);
ActionServlet actionServlet = new ActionServlet() {
@Override
public ServletContext getServletContext() {
return servletContext;
}
};
ActionSupport action = new ActionSupport() {
};
action.setServlet(actionServlet);
assertEquals(wac, action.getWebApplicationContext());
assertEquals(servletContext, action.getServletContext());
assertEquals("testmessage", action.getMessageSourceAccessor().getMessage("test"));
action.setServlet(null);
}
@Test
public void actionSupportWithRootContext() throws ServletException {
StaticWebApplicationContext wac = new StaticWebApplicationContext();
wac.addMessage("test", Locale.getDefault(), "testmessage");
final ServletContext servletContext = new MockServletContext();
wac.setServletContext(servletContext);
wac.refresh();
servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
ActionServlet actionServlet = new ActionServlet() {
@Override
public ServletContext getServletContext() {
return servletContext;
}
};
ActionSupport action = new ActionSupport() {
};
action.setServlet(actionServlet);
assertEquals(wac, action.getWebApplicationContext());
assertEquals(servletContext, action.getServletContext());
assertEquals("testmessage", action.getMessageSourceAccessor().getMessage("test"));
action.setServlet(null);
}
@Test
public void dispatchActionSupportWithContextLoaderPlugIn() throws ServletException {
StaticWebApplicationContext wac = new StaticWebApplicationContext();
wac.addMessage("test", Locale.getDefault(), "testmessage");
final ServletContext servletContext = new MockServletContext();
wac.setServletContext(servletContext);
wac.refresh();
servletContext.setAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX, wac);
ActionServlet actionServlet = new ActionServlet() {
@Override
public ServletContext getServletContext() {
return servletContext;
}
};
DispatchActionSupport action = new DispatchActionSupport() {
};
action.setServlet(actionServlet);
assertEquals(wac, action.getWebApplicationContext());
assertEquals(servletContext, action.getServletContext());
assertEquals("testmessage", action.getMessageSourceAccessor().getMessage("test"));
action.setServlet(null);
}
@Test
public void dispatchActionSupportWithRootContext() throws ServletException {
StaticWebApplicationContext wac = new StaticWebApplicationContext();
wac.addMessage("test", Locale.getDefault(), "testmessage");
final ServletContext servletContext = new MockServletContext();
wac.setServletContext(servletContext);
wac.refresh();
servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
ActionServlet actionServlet = new ActionServlet() {
@Override
public ServletContext getServletContext() {
return servletContext;
}
};
DispatchActionSupport action = new DispatchActionSupport() {
};
action.setServlet(actionServlet);
assertEquals(wac, action.getWebApplicationContext());
assertEquals(servletContext, action.getServletContext());
assertEquals("testmessage", action.getMessageSourceAccessor().getMessage("test"));
action.setServlet(null);
}
@Test
public void lookupDispatchActionSupportWithContextLoaderPlugIn() throws ServletException {
StaticWebApplicationContext wac = new StaticWebApplicationContext();
wac.addMessage("test", Locale.getDefault(), "testmessage");
final ServletContext servletContext = new MockServletContext();
wac.setServletContext(servletContext);
wac.refresh();
servletContext.setAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX, wac);
ActionServlet actionServlet = new ActionServlet() {
@Override
public ServletContext getServletContext() {
return servletContext;
}
};
LookupDispatchActionSupport action = new LookupDispatchActionSupport() {
@Override
protected Map getKeyMethodMap() {
return new HashMap();
}
};
action.setServlet(actionServlet);
assertEquals(wac, action.getWebApplicationContext());
assertEquals(servletContext, action.getServletContext());
assertEquals("testmessage", action.getMessageSourceAccessor().getMessage("test"));
action.setServlet(null);
}
@Test
public void lookupDispatchActionSupportWithRootContext() throws ServletException {
StaticWebApplicationContext wac = new StaticWebApplicationContext();
wac.addMessage("test", Locale.getDefault(), "testmessage");
final ServletContext servletContext = new MockServletContext();
wac.setServletContext(servletContext);
wac.refresh();
servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
ActionServlet actionServlet = new ActionServlet() {
@Override
public ServletContext getServletContext() {
return servletContext;
}
};
LookupDispatchActionSupport action = new LookupDispatchActionSupport() {
@Override
protected Map getKeyMethodMap() {
return new HashMap();
}
};
action.setServlet(actionServlet);
assertEquals(wac, action.getWebApplicationContext());
assertEquals(servletContext, action.getServletContext());
assertEquals("testmessage", action.getMessageSourceAccessor().getMessage("test"));
action.setServlet(null);
}
@Test
public void testDelegatingActionProxy() throws Exception {
final MockServletContext servletContext = new MockServletContext("/org/springframework/web/struts/");
ContextLoaderPlugIn plugin = new ContextLoaderPlugIn();
ActionServlet actionServlet = new ActionServlet() {
@Override
public String getServletName() {
return "action";
}
@Override
public ServletContext getServletContext() {
return servletContext;
}
};
ModuleConfig moduleConfig = createMock(ModuleConfig.class);
expect(moduleConfig.getPrefix()).andReturn("").anyTimes();
replay(moduleConfig);
plugin.init(actionServlet, moduleConfig);
assertTrue(servletContext.getAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX) != null);
DelegatingActionProxy proxy = new DelegatingActionProxy();
proxy.setServlet(actionServlet);
ActionMapping mapping = new ActionMapping();
mapping.setPath("/test");
mapping.setModuleConfig(moduleConfig);
ActionForward forward = proxy.execute(
mapping, null, new MockHttpServletRequest(servletContext), new MockHttpServletResponse());
assertEquals("/test", forward.getPath());
TestAction testAction = (TestAction) plugin.getWebApplicationContext().getBean("/test");
assertTrue(testAction.getServlet() != null);
proxy.setServlet(null);
plugin.destroy();
assertTrue(testAction.getServlet() == null);
verify(moduleConfig);
}
@Test
public void delegatingActionProxyWithModule() throws Exception {
final MockServletContext servletContext = new MockServletContext("/org/springframework/web/struts/WEB-INF");
ContextLoaderPlugIn plugin = new ContextLoaderPlugIn();
plugin.setContextConfigLocation("action-servlet.xml");
ActionServlet actionServlet = new ActionServlet() {
@Override
public String getServletName() {
return "action";
}
@Override
public ServletContext getServletContext() {
return servletContext;
}
};
ModuleConfig moduleConfig = createMock(ModuleConfig.class);
expect(moduleConfig.getPrefix()).andReturn("/module").anyTimes();
replay(moduleConfig);
plugin.init(actionServlet, moduleConfig);
assertTrue(servletContext.getAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX) == null);
assertTrue(servletContext.getAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX + "/module") != null);
DelegatingActionProxy proxy = new DelegatingActionProxy();
proxy.setServlet(actionServlet);
ActionMapping mapping = new ActionMapping();
mapping.setPath("/test2");
mapping.setModuleConfig(moduleConfig);
ActionForward forward = proxy.execute(
mapping, null, new MockHttpServletRequest(servletContext), new MockHttpServletResponse());
assertEquals("/module/test2", forward.getPath());
TestAction testAction = (TestAction) plugin.getWebApplicationContext().getBean("/module/test2");
assertTrue(testAction.getServlet() != null);
proxy.setServlet(null);
plugin.destroy();
assertTrue(testAction.getServlet() == null);
verify(moduleConfig);
}
@Test
public void delegatingActionProxyWithModuleAndDefaultContext() throws Exception {
final MockServletContext servletContext = new MockServletContext("/org/springframework/web/struts/WEB-INF");
ContextLoaderPlugIn plugin = new ContextLoaderPlugIn();
plugin.setContextConfigLocation("action-servlet.xml");
ActionServlet actionServlet = new ActionServlet() {
@Override
public String getServletName() {
return "action";
}
@Override
public ServletContext getServletContext() {
return servletContext;
}
};
ModuleConfig defaultModuleConfig = createMock(ModuleConfig.class);
expect(defaultModuleConfig.getPrefix()).andReturn("").anyTimes();
ModuleConfig moduleConfig = createMock(ModuleConfig.class);
expect(moduleConfig.getPrefix()).andReturn("/module").anyTimes();
replay(defaultModuleConfig, moduleConfig);
plugin.init(actionServlet, defaultModuleConfig);
assertTrue(servletContext.getAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX) != null);
assertTrue(servletContext.getAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX + "/module") == null);
DelegatingActionProxy proxy = new DelegatingActionProxy();
proxy.setServlet(actionServlet);
ActionMapping mapping = new ActionMapping();
mapping.setPath("/test2");
mapping.setModuleConfig(moduleConfig);
ActionForward forward = proxy.execute(
mapping, null, new MockHttpServletRequest(servletContext), new MockHttpServletResponse());
assertEquals("/module/test2", forward.getPath());
TestAction testAction = (TestAction) plugin.getWebApplicationContext().getBean("/module/test2");
assertTrue(testAction.getServlet() != null);
proxy.setServlet(null);
plugin.destroy();
assertTrue(testAction.getServlet() == null);
verify(defaultModuleConfig, moduleConfig);
}
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright 2002-2006 the original author or authors.
*
* Licensed 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.
*/
package org.springframework.web.struts;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.beans.factory.BeanNameAware;
/**
* @author Juergen Hoeller
* @since 09.04.2004
*/
public class TestAction extends Action implements BeanNameAware {
private String beanName;
public void setBeanName(String beanName) {
this.beanName = beanName;
}
@Override
public ActionForward execute(
ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){
return new ActionForward(this.beanName);
}
}

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- Appenders -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
</layout>
</appender>
<logger name="org.springframework.beans">
<level value="warn" />
</logger>
<logger name="org.springframework.binding">
<level value="debug" />
</logger>
<!-- Root Logger -->
<root>
<priority value="warn" />
<appender-ref ref="console" />
</root>
</log4j:configuration>

View File

@@ -0,0 +1,6 @@
code1=message1
code2=message2
# Example taken from the javadocs for the java.text.MessageFormat class
message.format.example1=At '{1,time}' on "{1,date}", there was "{2}" on planet {0,number,integer}.
message.format.example2=This is a test message in the message catalog with no args.

View File

@@ -0,0 +1,2 @@
# Example taken from the javadocs for the java.text.MessageFormat class
message.format.example1=At '{1,time}' on "{1,date}", there was "{2}" on station number {0,number,integer}.

View File

@@ -0,0 +1,5 @@
code1=message1
# Example taken from the javadocs for the java.text.MessageFormat class
message.format.example1=At '{1,time}' on "{1,date}", there was "{2}" on planet {0,number,integer}.
message.format.example2=This is a test message in the message catalog with no args.

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
<tiles-definitions>
<definition name="testTile" path="/WEB-INF/jsp/layout.jsp">
<put name="content" value="/WEB-INF/jsp/content.jsp" type="page"/>
</definition>
<definition name="testTileWithController" controllerClass="org.springframework.web.servlet.view.tiles.TestComponentController">
<put name="content" value="/WEB-INF/jsp/otherContent.jsp" type="page"/>
</definition>
</tiles-definitions>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean name="/test" class="org.springframework.web.struts.TestAction"/>
<bean name="/module/test2" class="org.springframework.web.struts.TestAction"/>
</beans>