mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
WW-3872 adds Tiles support to portlet example app
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1394440 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
<validators>
|
||||
<field name="firstName">
|
||||
<field-validator type="requiredstring">
|
||||
<message>You must enter a first name</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="lastName">
|
||||
<field-validator type="requiredstring">
|
||||
<message>You must enter a last name</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="tiles" extends="struts-portlet-tiles-default" namespace="/tiles">
|
||||
<default-action-ref name="index"/>
|
||||
|
||||
<action name="index" class="org.apache.struts2.portlet.example.FormExample">
|
||||
<result type="tiles">formExampleTiles.index</result>
|
||||
<result name="success" type="tiles">formExampleTiles.index</result>
|
||||
</action>
|
||||
|
||||
<action name="processTilesFreemarkerExample" class="org.apache.struts2.portlet.example.FormExample" method="input">
|
||||
<result name="success" type="tiles">formExampleTiles.freemarker</result>
|
||||
</action>
|
||||
|
||||
<action name="processTilesFreemarkerExample" class="org.apache.struts2.portlet.example.FormExample" method="execute">
|
||||
<result name="input" type="tiles">formExampleTiles.freemarker</result>
|
||||
<result name="success" type="tiles">formExampleTiles.freemarkerResult</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
</struts>
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!--
|
||||
/*
|
||||
* 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 tiles-definitions PUBLIC
|
||||
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
|
||||
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
|
||||
|
||||
<tiles-definitions>
|
||||
|
||||
<definition name="formExampleTiles.index" template="/WEB-INF/tiles/layout.jsp">
|
||||
<put-attribute name="title" value="Portlet Tiles FormExample"/>
|
||||
<put-attribute name="header" value="/WEB-INF/tiles/header.jsp"/>
|
||||
<put-attribute name="body" value="/WEB-INF/tiles/index.jsp"/>
|
||||
<put-attribute name="footer" value="/WEB-INF/tiles/footer.jsp"/>
|
||||
</definition>
|
||||
|
||||
<definition name="formExampleTiles.freemarker" extends="formExampleTiles.index">
|
||||
<put-attribute name="title" value="Portlet Tiles/Freemarker FormExample"/>
|
||||
<put-attribute name="body" value="/WEB-INF/tiles/formExampleInputValidation.jsp"/>
|
||||
</definition>
|
||||
|
||||
<definition name="formExampleTiles.freemarkerResult" extends="formExampleTiles.freemarker">
|
||||
<put-attribute name="body" value="/WEB-INF/tiles/formExample.jsp"/>
|
||||
</definition>
|
||||
|
||||
</tiles-definitions>
|
||||
@@ -0,0 +1,5 @@
|
||||
<hr/>
|
||||
<@s.url id="home" action="index" namespace="/view" />
|
||||
<div>
|
||||
<p>Powered by Struts2 Portlet/Tiles Plugin | <@s.a href="${home}">Back to front page</@s.a></p>
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<hr/>
|
||||
<s:url id="home" action="index" namespace="/view" />
|
||||
<div>
|
||||
<p>Powered by Struts2 Portlet/Tiles Plugin | <s:a href="%{home}">Back to front page</s:a></p>
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<H2>Hello <s:property value="firstName"/> <s:property value="lastName"/></H2>
|
||||
<p/>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<link rel="stylesheet" type="text/css" href="<s:url value="/styles/styles.css"/>">
|
||||
<H2>Input your name</H2>
|
||||
<s:form action="processTilesFreemarkerExample" namespace="/tiles" method="POST" >
|
||||
<s:textfield label="First name" name="firstName" value="%{firstName}"/>
|
||||
<s:textfield label="Last name" name="lastName" value="%{lastName}"/>
|
||||
<s:submit value="Submit the form"/>
|
||||
</s:form>
|
||||
@@ -0,0 +1,2 @@
|
||||
<h1>Struts2 Portlet Tiles App Example</h1>
|
||||
<hr/>
|
||||
@@ -0,0 +1,13 @@
|
||||
<%@taglib prefix="s" uri="/struts-tags" %>
|
||||
<div>
|
||||
<p>This example illustrates the Struts/Portlet/Tiles Plugin.</p>
|
||||
|
||||
<h4>Features</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<s:url id="freemarker" namespace="/tiles" action="processTilesFreemarkerExample" method="input" />
|
||||
<s:a href="%{freemarker}">View FreeMarker Example</s:a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<tiles:importAttribute name="title" scope="request"/>
|
||||
|
||||
<tiles:insertAttribute name="header"/>
|
||||
<h2><tiles:insertAttribute name="title"/></h2>
|
||||
<p id="body">
|
||||
<tiles:insertAttribute name="body"/>
|
||||
</p>
|
||||
|
||||
<p>Notice that this is a layout made in JSP</p>
|
||||
|
||||
<tiles:insertAttribute name="footer"/>
|
||||
Reference in New Issue
Block a user