http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/access-to-valuestack-from-jsps.html ---------------------------------------------------------------------- diff --git a/content/docs/access-to-valuestack-from-jsps.html b/content/docs/access-to-valuestack-from-jsps.html new file mode 100644 index 0000000..33c13c3 --- /dev/null +++ b/content/docs/access-to-valuestack-from-jsps.html @@ -0,0 +1,241 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!-- +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. +--> +<html> +<head> + <link type="text/css" rel="stylesheet" href="https://struts.apache.org/css/default.css"> + <style type="text/css"> + .dp-highlighter { + width:95% !important; + } + </style> + <style type="text/css"> + .footer { + background-image: url('https://cwiki.apache.org/confluence/images/border/border_bottom.gif'); + background-repeat: repeat-x; + background-position: left top; + padding-top: 4px; + color: #666; + } + </style> + <link href='https://struts.apache.org/highlighter/style/shCoreStruts.css' rel='stylesheet' type='text/css' /> + <link href='https://struts.apache.org/highlighter/style/shThemeStruts.css' rel='stylesheet' type='text/css' /> + <script src='https://struts.apache.org/highlighter/js/shCore.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushPlain.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushXml.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJava.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJScript.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushGroovy.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushBash.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushCss.js' type='text/javascript'></script> + <script type="text/javascript"> + SyntaxHighlighter.defaults['toolbar'] = false; + SyntaxHighlighter.all(); + </script> + <script type="text/javascript" language="javascript"> + var hide = null; + var show = null; + var children = null; + + function init() { + /* Search form initialization */ + var form = document.forms['search']; + if (form != null) { + form.elements['domains'].value = location.hostname; + form.elements['sitesearch'].value = location.hostname; + } + + /* Children initialization */ + hide = document.getElementById('hide'); + show = document.getElementById('show'); + children = document.all != null ? + document.all['children'] : + document.getElementById('children'); + if (children != null) { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + } + + function showChildren() { + children.style.display = 'block'; + show.style.display = 'none'; + hide.style.display = 'inline'; + } + + function hideChildren() { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + </script> + <title>Access to ValueStack from JSPs</title> +</head> +<body onload="init()"> +<table border="0" cellpadding="2" cellspacing="0" width="100%"> + <tr class="topBar"> + <td align="left" valign="middle" class="topBarDiv" align="left" nowrap> + <a href="home.html">Home</a> > <a href="guides.html">Guides</a> > <a href="tag-developers-guide.html">Tag Developers Guide</a> > <a href="jsp.html">JSP</a> > <a href="access-to-valuestack-from-jsps.html">Access to ValueStack from JSPs</a> + </td> + <td align="right" valign="middle" nowrap> + <form name="search" action="https://www.google.com/search" method="get"> + <input type="hidden" name="ie" value="UTF-8" /> + <input type="hidden" name="oe" value="UTF-8" /> + <input type="hidden" name="domains" value="" /> + <input type="hidden" name="sitesearch" value="" /> + <input type="text" name="q" maxlength="255" value="" /> + <input type="submit" name="btnG" value="Google Search" /> + </form> + </td> + </tr> +</table> + +<div id="PageContent"> + <div class="pageheader" style="padding: 6px 0px 0px 0px;"> + <!-- We'll enable this once we figure out how to access (and save) the logo resource --> + <!--img src="/wiki/images/confluence_logo.gif" style="float: left; margin: 4px 4px 4px 10px;" border="0"--> + <div style="margin: 0px 10px 0px 10px" class="smalltext">Apache Struts 2 Documentation</div> + <div style="margin: 0px 10px 8px 10px" class="pagetitle">Access to ValueStack from JSPs</div> + + <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14315"> + <img src="https://cwiki.apache.org/confluence/images/icons/notep_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Edit Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14315">Edit Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW"> + <img src="https://cwiki.apache.org/confluence/images/icons/browse_space.gif" + height="16" width="16" border="0" align="absmiddle" title="Browse Space"></a> + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW">Browse Space</a> + + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14315"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_page_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14315">Add Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14315"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_blogentry_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add News"></a> + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14315">Add News</a> + </div> + </div> + + <div class="pagecontent"> + <div class="wiki-content"> + <div id="ConfluenceContent"><p>To access the ValueStack from third-party JSP taglibs, expose property values to JSP using the <code><s:set</code> tag.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Set a request scoped parameter 'a' to list of integers</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><s:set name="'a'" value="{ 1, 2, 3, 4 }" scope="request"/> +</pre> +</div></div><p>After setting parameters, third-party JSP taglibs can access variables or use JSP 2.0 EL (Expression Language). This is convenient as short hand EL expression syntax<br clear="none"> <code>${expression</code>}</p><p>can be used in a text or inside of tag attributes:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">a[0] = ${a[0]} + +<sample:tag value="${a[1]}"/> +</pre> +</div></div><p>In practice, several variables must be exposed to make effective use of third party taglibs like <a shape="rect" class="external-link" href="http://displaytag.sourceforge.net/11/" rel="nofollow">DisplayTag</a>. Unfortunately, this approach leads to a lot of <code><ww:set/></code> tags.</p><div class="confluence-information-macro confluence-information-macro-note"><p class="title">Why can't we just replace EL with OGNL?</p><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Unfortunately, it isn't that simple. we tinkered with <code>JSPFactory.setDefault()</code> to wrap around <code>getPageContext()</code> and create <code>ExpressionEvaluator</code> that would use OGNL. This strategy works in practice, but code generated by Jasper2 doesn't call <code>JSPFactory.getPageContext().getExpressionEvaluator()</code> but goes directly to static method that is hardwired to J akarta Commons-EL implementation.</p><p>Even if this approach did work, it wouldn't be <em>clean</em> as <code>JSPFactory.setDefault()</code> should only be called by JSP implementation.</p></div></div><p>There is a simple, if not elegant, solution available in JSP 2.0 EL, for exposing ValueStack to OGNL. It is possible to create custom functions that can be called from EL expressions. Functions have to be 'public static' and specified in a TLD file.<br clear="none"> To use a function, import the TLD in a JSP file where you've want to use a function. For example, you could access Action properties by evaluating OGNL expression by a function 'vs' (for valuestack) in EL.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><%@ taglib uri="/WEB-INF/tld/wwel.tld" prefix="x" %> + +a[0] = ${x:vs('a[0]')} +a[0] * 4 = ${x:vs('a[0] * 4')} + +Current action name: ${x:name()} +Top of ValueStack: ${x:top()} +</pre> +</div></div><p>To use this code you've got to add <code>wwel.tld</code> and <code>Functions.java</code> to your webapp project.</p><div class="confluence-information-macro confluence-information-macro-tip"><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If someone were interested, it would be helpful for a developer (like you!) to define a set of functions that we could include in a future release of the framework.</p></div></div><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>wwel.tld</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><?xml version="1.0"?> +<taglib 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-jsptaglibrary_2_0.xsd" + version="2.0"> + +<description> +This taglib enables access to the ValueStack +from JSP 2.0 Expression Language +</description> + +<tlib-version>1.0</tlib-version> + +<short-name>wwel</short-name> + +<function> + <name>vs</name> + <function-class>com.nmote.wwel.Functions</function-class> + <function-signature> + java.lang.Object findOnValueStack(java.lang.String) + </function-signature> +</function> + +<function> + <name>name</name> + <function-class>com.nmote.wwel.Functions</function-class> + <function-signature> + java.lang.Object getActionName() + </function-signature> +</function> + +<function> + <name>top</name> + <function-class>com.nmote.wwel.Functions</function-class> + <function-signature> + java.lang.Object getTopOfValueStack() + </function-signature> +</function> + +</taglib> +</pre> +</div></div><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Functions.java</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">package com.nmote.wwel; + +import com.opensymphony.xwork.ActionContext; + +/** + * Utility functions for accessing value stack and action context + * from JSP 2.0 EL taglibs. + */ +public class Functions { + + public static Object findOnValueStack(String expr) { + ActionContext a = ActionContext.getContext(); + Object value = a.getValueStack().findValue(expr); + return value; + } + + public static Object getTopOfValueStack() { + ActionContext a = ActionContext.getContext(); + Object value = a.getValueStack().peek(); + return value; + } + + public static Object getActionName() { + ActionContext a = ActionContext.getContext(); + Object value = a.getName(); + return value; + } +} +</pre> +</div></div></div> + </div> + + + </div> +</div> +<div class="footer"> + Generated by CXF SiteExporter +</div> +</body> +</html>
http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/accessing-application-session-request-objects.html ---------------------------------------------------------------------- diff --git a/content/docs/accessing-application-session-request-objects.html b/content/docs/accessing-application-session-request-objects.html new file mode 100644 index 0000000..c1be128 --- /dev/null +++ b/content/docs/accessing-application-session-request-objects.html @@ -0,0 +1,201 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!-- +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. +--> +<html> +<head> + <link type="text/css" rel="stylesheet" href="https://struts.apache.org/css/default.css"> + <style type="text/css"> + .dp-highlighter { + width:95% !important; + } + </style> + <style type="text/css"> + .footer { + background-image: url('https://cwiki.apache.org/confluence/images/border/border_bottom.gif'); + background-repeat: repeat-x; + background-position: left top; + padding-top: 4px; + color: #666; + } + </style> + <link href='https://struts.apache.org/highlighter/style/shCoreStruts.css' rel='stylesheet' type='text/css' /> + <link href='https://struts.apache.org/highlighter/style/shThemeStruts.css' rel='stylesheet' type='text/css' /> + <script src='https://struts.apache.org/highlighter/js/shCore.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushPlain.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushXml.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJava.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJScript.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushGroovy.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushBash.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushCss.js' type='text/javascript'></script> + <script type="text/javascript"> + SyntaxHighlighter.defaults['toolbar'] = false; + SyntaxHighlighter.all(); + </script> + <script type="text/javascript" language="javascript"> + var hide = null; + var show = null; + var children = null; + + function init() { + /* Search form initialization */ + var form = document.forms['search']; + if (form != null) { + form.elements['domains'].value = location.hostname; + form.elements['sitesearch'].value = location.hostname; + } + + /* Children initialization */ + hide = document.getElementById('hide'); + show = document.getElementById('show'); + children = document.all != null ? + document.all['children'] : + document.getElementById('children'); + if (children != null) { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + } + + function showChildren() { + children.style.display = 'block'; + show.style.display = 'none'; + hide.style.display = 'inline'; + } + + function hideChildren() { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + </script> + <title>Accessing application, session, request objects</title> +</head> +<body onload="init()"> +<table border="0" cellpadding="2" cellspacing="0" width="100%"> + <tr class="topBar"> + <td align="left" valign="middle" class="topBarDiv" align="left" nowrap> + <a href="home.html">Home</a> > <a href="guides.html">Guides</a> > <a href="core-developers-guide.html">Core Developers Guide</a> > <a href="accessing-application-session-request-objects.html">Accessing application, session, request objects</a> + </td> + <td align="right" valign="middle" nowrap> + <form name="search" action="https://www.google.com/search" method="get"> + <input type="hidden" name="ie" value="UTF-8" /> + <input type="hidden" name="oe" value="UTF-8" /> + <input type="hidden" name="domains" value="" /> + <input type="hidden" name="sitesearch" value="" /> + <input type="text" name="q" maxlength="255" value="" /> + <input type="submit" name="btnG" value="Google Search" /> + </form> + </td> + </tr> +</table> + +<div id="PageContent"> + <div class="pageheader" style="padding: 6px 0px 0px 0px;"> + <!-- We'll enable this once we figure out how to access (and save) the logo resource --> + <!--img src="/wiki/images/confluence_logo.gif" style="float: left; margin: 4px 4px 4px 10px;" border="0"--> + <div style="margin: 0px 10px 0px 10px" class="smalltext">Apache Struts 2 Documentation</div> + <div style="margin: 0px 10px 8px 10px" class="pagetitle">Accessing application, session, request objects</div> + + <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14232"> + <img src="https://cwiki.apache.org/confluence/images/icons/notep_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Edit Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14232">Edit Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW"> + <img src="https://cwiki.apache.org/confluence/images/icons/browse_space.gif" + height="16" width="16" border="0" align="absmiddle" title="Browse Space"></a> + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW">Browse Space</a> + + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14232"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_page_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14232">Add Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14232"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_blogentry_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add News"></a> + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14232">Add News</a> + </div> + </div> + + <div class="pagecontent"> + <div class="wiki-content"> + <div id="ConfluenceContent"><p>The framework provides several access helpers to access Session, Application, Request scopes.</p> + +<h2 id="Accessingapplication,session,requestobjects-AccessingfromJava">Accessing from Java</h2> + +<p>All the JEE scope attribute maps can be accessed via <code>ActionContext</code>.</p> + +<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Accessing servlet scopes</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"> +Map attr = (Map) ActionContext.getContext().get("attr"); +attr.put("myId",myProp); + +Map application = (Map) ActionContext.getContext().get("application"); +application.put("myId",myProp); + +Map session = (Map) ActionContext.getContext().get("session"); +session.put("myId", myProp); + +Map request = (Map) ActionContext.getContext().get("request"); +request.put("myId",myProp); +</pre> +</div></div> + +<div class="confluence-information-macro confluence-information-macro-warning"><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confluence-information-macro-body"> +<p>Do not use <code>ActionContext.getContext()</code> in the constructor of your Action class. The values may not be set up, and the call may return null for <code>getSession()</code>.</p></div></div> + +<p>We can also access the <code>HttpServletRequest</code> and <code>HttpServletResponse</code> objects themselves through <code>ServletActionContext</code>. In general this isn't recommended as it will tie our action to the servlet specification.</p> + +<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Setting session attribute through session object</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"> +ServletActionContext.getRequest().getSession().put("myId", myProp); +</pre> +</div></div> + +<p>Implementing <code>ServletRequestAware</code> or <code>ServletResponseAware</code>, combined with the <code><a shape="rect" href="servlet-config-interceptor.html">"servletConfig" interceptor</a></code>, is an alternative way to access the request and response objects, with the same caveat.</p> + +<h2 id="Accessingapplication,session,requestobjects-Accessingfromtheview(JSP,FreeMarker,etc.)">Accessing from the view (JSP, FreeMarker, etc.)</h2> + +<p>Request and session attributes are accessed via OGNL using the <code>#session</code> and <code>#request</code> stack values.</p> + +<p>The <code>#attr</code> stack value will search the <code>javax.servlet.jsp.PageContext</code> for the specified key. If the <code>PageContext</code> doean't exist, it will search the request, session, and application scopes, in that order.</p> + +<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Accessing the Session or Request from a JSP</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"> +<s:property value="#session.myId" /> + +<s:property value="#request.myId" /> + +<s:property value="#attr.myId" /> +</pre> +</div></div></div> + </div> + + + </div> +</div> +<div class="footer"> + Generated by CXF SiteExporter +</div> +</body> +</html> http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/action-chaining.html ---------------------------------------------------------------------- diff --git a/content/docs/action-chaining.html b/content/docs/action-chaining.html new file mode 100644 index 0000000..a0fcfa6 --- /dev/null +++ b/content/docs/action-chaining.html @@ -0,0 +1,175 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!-- +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. +--> +<html> +<head> + <link type="text/css" rel="stylesheet" href="https://struts.apache.org/css/default.css"> + <style type="text/css"> + .dp-highlighter { + width:95% !important; + } + </style> + <style type="text/css"> + .footer { + background-image: url('https://cwiki.apache.org/confluence/images/border/border_bottom.gif'); + background-repeat: repeat-x; + background-position: left top; + padding-top: 4px; + color: #666; + } + </style> + <link href='https://struts.apache.org/highlighter/style/shCoreStruts.css' rel='stylesheet' type='text/css' /> + <link href='https://struts.apache.org/highlighter/style/shThemeStruts.css' rel='stylesheet' type='text/css' /> + <script src='https://struts.apache.org/highlighter/js/shCore.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushPlain.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushXml.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJava.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJScript.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushGroovy.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushBash.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushCss.js' type='text/javascript'></script> + <script type="text/javascript"> + SyntaxHighlighter.defaults['toolbar'] = false; + SyntaxHighlighter.all(); + </script> + <script type="text/javascript" language="javascript"> + var hide = null; + var show = null; + var children = null; + + function init() { + /* Search form initialization */ + var form = document.forms['search']; + if (form != null) { + form.elements['domains'].value = location.hostname; + form.elements['sitesearch'].value = location.hostname; + } + + /* Children initialization */ + hide = document.getElementById('hide'); + show = document.getElementById('show'); + children = document.all != null ? + document.all['children'] : + document.getElementById('children'); + if (children != null) { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + } + + function showChildren() { + children.style.display = 'block'; + show.style.display = 'none'; + hide.style.display = 'inline'; + } + + function hideChildren() { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + </script> + <title>Action Chaining</title> +</head> +<body onload="init()"> +<table border="0" cellpadding="2" cellspacing="0" width="100%"> + <tr class="topBar"> + <td align="left" valign="middle" class="topBarDiv" align="left" nowrap> + <a href="home.html">Home</a> > <a href="guides.html">Guides</a> > <a href="core-developers-guide.html">Core Developers Guide</a> > <a href="action-chaining.html">Action Chaining</a> + </td> + <td align="right" valign="middle" nowrap> + <form name="search" action="https://www.google.com/search" method="get"> + <input type="hidden" name="ie" value="UTF-8" /> + <input type="hidden" name="oe" value="UTF-8" /> + <input type="hidden" name="domains" value="" /> + <input type="hidden" name="sitesearch" value="" /> + <input type="text" name="q" maxlength="255" value="" /> + <input type="submit" name="btnG" value="Google Search" /> + </form> + </td> + </tr> +</table> + +<div id="PageContent"> + <div class="pageheader" style="padding: 6px 0px 0px 0px;"> + <!-- We'll enable this once we figure out how to access (and save) the logo resource --> + <!--img src="/wiki/images/confluence_logo.gif" style="float: left; margin: 4px 4px 4px 10px;" border="0"--> + <div style="margin: 0px 10px 0px 10px" class="smalltext">Apache Struts 2 Documentation</div> + <div style="margin: 0px 10px 8px 10px" class="pagetitle">Action Chaining</div> + + <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14214"> + <img src="https://cwiki.apache.org/confluence/images/icons/notep_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Edit Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14214">Edit Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW"> + <img src="https://cwiki.apache.org/confluence/images/icons/browse_space.gif" + height="16" width="16" border="0" align="absmiddle" title="Browse Space"></a> + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW">Browse Space</a> + + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14214"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_page_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14214">Add Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14214"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_blogentry_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add News"></a> + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14214">Add News</a> + </div> + </div> + + <div class="pagecontent"> + <div class="wiki-content"> + <div id="ConfluenceContent"><p>The framework provides the ability to chain multiple actions into a defined sequence or workflow. This feature works by applying a <a shape="rect" href="chain-result.html">Chain Result</a> to a given Action, and intercepting its target Action's invocation with a <a shape="rect" href="chaining-interceptor.html">Chaining Interceptor</a>.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Don't Try This at Home</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>As a rule, Action Chaining is not recommended. First explore other options, such as the <a shape="rect" href="redirect-after-post.html">Redirect After Post</a> technique.</p></div></div><h2 id="ActionChaining-ChainResult">Chain Result</h2><p>The <a shape="rect" href="chain-result.html">Chain Result</a> is a result type that invokes an Action w ith its own Interceptor Stack and Result. This Interceptor allows an Action to forward requests to a target Action, while propagating the state of the source Action. Below is an example of how to define this sequence.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ +<package name="public" extends="struts-default"> + <!-- Chain creatAccount to login, using the default parameter --> + <action name="createAccount" class="..."> + <result type="chain">login</result> + </action> + + <action name="login" class="..."> + <!-- Chain to another namespace --> + <result type="chain"> + <param name="actionName">dashboard</param> + <param name="namespace">/secure</param> + </result> + </action> +</package> + +<package name="secure" extends="struts-default" namespace="/secure"> + <action name="dashboard" class="..."> + <result>dashboard.jsp</result> + </action> +</package> +]]></script> +</div></div><p>Another action mapping in the same namespace (or the default "" namespace) can be executed after this action mapping (see <a shape="rect" href="configuration-files.html">Configuration Files</a>). An optional "namespace" parameter may also be added to specify an action in a different namespace.</p><h2 id="ActionChaining-ChainingInterceptor">Chaining Interceptor</h2><p>If you need to copy the properties from your previous Actions in the chain to the current action, you should apply the <a shape="rect" href="chaining-interceptor.html">Chaining Interceptor</a>. The Interceptor will copy the original parameters from the request, and the ValueStack is passed in to the target Action. The source Action is remembered by the ValueStack, allowing the target Action to access the properties of the preceding Action(s) using the ValueStack, and also makes these properties available to the final result of the chain, such as the JSP or Velocity page.</p><p>One common use of Action cha ining is to provide lookup lists (like for a dropdown list of states). Since these Actions get put on the ValueStack, their properties will be available in the view. This functionality can also be done using the ActionTag to execute an Action from the display page. You may also use the <a shape="rect" href="redirect-action-result.html">Redirect Action Result</a> to accomplish this.</p><h3 id="ActionChaining-Usewithcare">Use with care</h3><p>Experience shows that chaining should be used with care. If chaining is overused, an application can turn into "spaghetti code". Actions should be treated as a <a shape="rect" class="external-link" href="http://martinfowler.com/eaaCatalog/transactionScript.html" rel="nofollow">Transaction Script</a>, rather than as methods in a <a shape="rect" class="external-link" href="http://msdn2.microsoft.com/en-us/library/aa291571(VS.71).aspx" rel="nofollow">Business Facade</a>. Be sure to ask yourself why you need to chain from one Action to another. Is a navigational issue, or could the logic in Action2 be pushed back to a support class or business facade so that Action1 can call it too?</p><p>Ideally, Action classes should be as short as possible. All the core logic should be pushed back to a support class or a business facade, so that Actions only call methods. Actions are best used as adapters, rather than as a class where coding logic is defined.</p><h2 id="ActionChaining-Next:">Next: <a shape="rect" href="result-types.html">Result Types</a></h2></div> + </div> + + + </div> +</div> +<div class="footer"> + Generated by CXF SiteExporter +</div> +</body> +</html> http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/action-configuration.html ---------------------------------------------------------------------- diff --git a/content/docs/action-configuration.html b/content/docs/action-configuration.html new file mode 100644 index 0000000..ff4c307 --- /dev/null +++ b/content/docs/action-configuration.html @@ -0,0 +1,296 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!-- +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. +--> +<html> +<head> + <link type="text/css" rel="stylesheet" href="https://struts.apache.org/css/default.css"> + <style type="text/css"> + .dp-highlighter { + width:95% !important; + } + </style> + <style type="text/css"> + .footer { + background-image: url('https://cwiki.apache.org/confluence/images/border/border_bottom.gif'); + background-repeat: repeat-x; + background-position: left top; + padding-top: 4px; + color: #666; + } + </style> + <link href='https://struts.apache.org/highlighter/style/shCoreStruts.css' rel='stylesheet' type='text/css' /> + <link href='https://struts.apache.org/highlighter/style/shThemeStruts.css' rel='stylesheet' type='text/css' /> + <script src='https://struts.apache.org/highlighter/js/shCore.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushPlain.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushXml.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJava.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJScript.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushGroovy.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushBash.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushCss.js' type='text/javascript'></script> + <script type="text/javascript"> + SyntaxHighlighter.defaults['toolbar'] = false; + SyntaxHighlighter.all(); + </script> + <script type="text/javascript" language="javascript"> + var hide = null; + var show = null; + var children = null; + + function init() { + /* Search form initialization */ + var form = document.forms['search']; + if (form != null) { + form.elements['domains'].value = location.hostname; + form.elements['sitesearch'].value = location.hostname; + } + + /* Children initialization */ + hide = document.getElementById('hide'); + show = document.getElementById('show'); + children = document.all != null ? + document.all['children'] : + document.getElementById('children'); + if (children != null) { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + } + + function showChildren() { + children.style.display = 'block'; + show.style.display = 'none'; + hide.style.display = 'inline'; + } + + function hideChildren() { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + </script> + <title>Action Configuration</title> +</head> +<body onload="init()"> +<table border="0" cellpadding="2" cellspacing="0" width="100%"> + <tr class="topBar"> + <td align="left" valign="middle" class="topBarDiv" align="left" nowrap> + <a href="home.html">Home</a> > <a href="guides.html">Guides</a> > <a href="core-developers-guide.html">Core Developers Guide</a> > <a href="configuration-elements.html">Configuration Elements</a> > <a href="action-configuration.html">Action Configuration</a> + </td> + <td align="right" valign="middle" nowrap> + <form name="search" action="https://www.google.com/search" method="get"> + <input type="hidden" name="ie" value="UTF-8" /> + <input type="hidden" name="oe" value="UTF-8" /> + <input type="hidden" name="domains" value="" /> + <input type="hidden" name="sitesearch" value="" /> + <input type="text" name="q" maxlength="255" value="" /> + <input type="submit" name="btnG" value="Google Search" /> + </form> + </td> + </tr> +</table> + +<div id="PageContent"> + <div class="pageheader" style="padding: 6px 0px 0px 0px;"> + <!-- We'll enable this once we figure out how to access (and save) the logo resource --> + <!--img src="/wiki/images/confluence_logo.gif" style="float: left; margin: 4px 4px 4px 10px;" border="0"--> + <div style="margin: 0px 10px 0px 10px" class="smalltext">Apache Struts 2 Documentation</div> + <div style="margin: 0px 10px 8px 10px" class="pagetitle">Action Configuration</div> + + <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14122"> + <img src="https://cwiki.apache.org/confluence/images/icons/notep_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Edit Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14122">Edit Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW"> + <img src="https://cwiki.apache.org/confluence/images/icons/browse_space.gif" + height="16" width="16" border="0" align="absmiddle" title="Browse Space"></a> + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW">Browse Space</a> + + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14122"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_page_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14122">Add Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14122"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_blogentry_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add News"></a> + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14122">Add News</a> + </div> + </div> + + <div class="pagecontent"> + <div class="wiki-content"> + <div id="ConfluenceContent"><p>The action mappings are the basic "unit-of-work" in the framework. Essentially, the action maps an identifier to a handler class. When a request matches the action's name, the framework uses the mapping to determine how to process the request.</p><p><style type="text/css">/*<![CDATA[*/ +div.rbtoc1488973753423 {padding: 0px;} +div.rbtoc1488973753423 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1488973753423 li {margin-left: 0px;padding-left: 0px;} + +/*]]>*/</style></p><div class="toc-macro rbtoc1488973753423"> +<ul class="toc-indentation"><li><a shape="rect" href="#ActionConfiguration-ActionMappings">Action Mappings</a></li><li><a shape="rect" href="#ActionConfiguration-ActionNames">Action Names</a> +<ul class="toc-indentation"><li><a shape="rect" href="#ActionConfiguration-ActionNamesWithSlashes">Action Names With Slashes</a></li><li><a shape="rect" href="#ActionConfiguration-ActionNameswithDotsandDashes">Action Names with Dots and Dashes</a></li><li><a shape="rect" href="#ActionConfiguration-Allowedactionnames">Allowed action names</a></li></ul> +</li><li><a shape="rect" href="#ActionConfiguration-ActionMethods">Action Methods</a></li><li><a shape="rect" href="#ActionConfiguration-WildcardMethod">Wildcard Method</a></li><li><a shape="rect" href="#ActionConfiguration-DynamicMethodInvocation">Dynamic Method Invocation</a> +<ul class="toc-indentation"><li><a shape="rect" href="#ActionConfiguration-StrictDMI">Strict DMI</a></li><li><a shape="rect" href="#ActionConfiguration-StrictMethodInvocation">Strict Method Invocation</a></li></ul> +</li><li><a shape="rect" href="#ActionConfiguration-ActionSupportDefault">ActionSupport Default</a></li><li><a shape="rect" href="#ActionConfiguration-Post-BackDefault">Post-Back Default</a></li><li><a shape="rect" href="#ActionConfiguration-ActionDefault">Action Default</a> +<ul class="toc-indentation"><li><a shape="rect" href="#ActionConfiguration-WildcardDefault">Wildcard Default</a></li></ul> +</li><li><a shape="rect" href="#ActionConfiguration-Next:">Next: Wildcard Mappings</a></li></ul> +</div><h2 id="ActionConfiguration-ActionMappings">Action Mappings</h2><p>The action mapping can specify a set of result types, a set of exception handlers, and an interceptor stack. Only the <code>name</code> attribute is required. The other attributes can also be provided at package scope.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>A Logon Action</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"><action name="Logon" class="tutorial.Logon"> + <result type="redirectAction">Menu</result> + <result name="input">/Logon.jsp</result> +</action> </pre> +</div></div><p>When using <a shape="rect" href="convention-plugin.html">Convention Plugin</a> the action mapping can be configured with annotations:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>A Logon Action with annotations</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">package tutorial + +@Action("Logon") // actually that is not necessary as it is added by convention +@Results( + @Result(type="redirectAction", location="Menu"), + @Result(name="input", location="/Logon.jsp") +) +public class Logon {</pre> +</div></div><h2 id="ActionConfiguration-ActionNames">Action Names</h2><p>In a web application, the <code>name</code> attribute is matched as part of the location requested by a browser (or other HTTP client). The framework will drop the host and application name and the extension and match what's in the middle: the action name. So, a request for <code><a shape="rect" class="external-link" href="http://www.planetstruts.org/struts2-mailreader/Welcome.action" rel="nofollow">http://www.planetstruts.org/struts2-mailreader/Welcome.action</a></code> will map to the <code>Welcome</code> action.</p><p>Within an application a link to an action is usually generated by a Struts Tag. The tag can specify the action by name, and the framework will render the default extension and anything else that is needed. Forms may also submit directly to a Struts Action name (rather than a "raw" URI).</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="bord er-bottom-width: 1px;"><b>A Hello Form</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"><s:form action="Hello"> + <s:textfield label="Please enter your name" name="name"/> + <s:submit/> +</s:form> +</pre> +</div></div><h3 id="ActionConfiguration-ActionNamesWithSlashes">Action Names With Slashes</h3><p><span>If your action names have slashes in them (for example, </span><code><action name="admin/home" class="tutorial.Admin"/></code><span>) you need to specifically allow slashes in your action names via a constant in the </span><code>struts.xml</code><span> file by specifying </span><code><constant name="struts.enable.SlashesInActionNames" value="true"/></code><span>. See </span><a shape="rect" class="external-link" href="https://issues.apache.org/jira/browse/WW-1383">JIRA Issue WW-1383</a><span> for discussion as there are side effects to setting this property to </span><code>true</code><span>.</span></p><h3 id="ActionConfiguration-ActionNameswithDotsandDashes">Action Names with Dots and Dashes</h3><p>Although action naming is pretty flexible, one should pay attention when using dots (eg. create.user) and/or dashes (eg. my-action). While the dot notation has no known side e ffects at this time, the dash notation will cause problems with the generated JavaScript for certain tags and themes. Use with caution, and always try to use camelcase action names (eg. createUser) or underscores (eg. my_action).</p><h3 id="ActionConfiguration-Allowedactionnames">Allowed action names</h3><p><code>DefaultActionMapper</code> is using pre-defined RegEx to check if action name matches allowed names. The default RegEx is defined as follow: <code>[a-zA-Z0-9._!/\-]*</code> - if at some point this doesn't match your action naming schema you can define your own RegEx and override the default using constant named <code>struts.allowed.action.names</code>, e.g.:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><struts> + <constant name="struts.allowed.action.names" value="[a-z{}]"*/> + ... +</struts></pre> +</div></div><p><strong>NOTE</strong>: Please be aware that action names not matching the RegEx will rise an exception.</p><h2 id="ActionConfiguration-ActionMethods">Action Methods</h2><p>The default entry method to the handler class is defined by the Action interface.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Action interface</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">public interface Action { + public String execute() throws Exception; +} +</pre> +</div></div><p><img class="emoticon emoticon-information" src="https://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/information.png" data-emoticon-name="information" alt="(info)"> Implementing the Action interface is optional. If Action is not implemented, the framework will use reflection to look for an <code>execute</code> method.</p><p>Sometimes, developers like to create more than one entry point to an Action. For example, in the case of a data-access Action, a developer might want separate entry-points for <code>create</code>, <code>retrieve</code>, <code>update</code>, and <code>delete</code>. A different entry point can be specified by the <code>method</code> attribute.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><action name="delete" class="example.CrudAction" method="delete"> + ... +</pre> +</div></div><p><img class="emoticon emoticon-warning" src="https://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/warning.png" data-emoticon-name="warning" alt="(warning)"> If there is no <code>execute</code> method and no other method specified in the configuration the framework will throw an exception.</p><p> </p><p><a shape="rect" href="convention-plugin.html">Convention Plugin</a> allows that by annotating methods:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Annotated action method</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">@Action("crud") +public class CrudAction { + @Action("delete") + public String delete() { + ... +</pre> +</div></div><h2 id="ActionConfiguration-WildcardMethod">Wildcard Method</h2><p>Many times, a set of action mappings will share a common pattern. For example, all your <code>edit</code> actions might start with the word "edit", and call the <code>edit</code> method on the Action class. The <code>delete</code> actions might use the same pattern, but call the <code>delete</code> method instead.</p><p>Rather than code a separate mapping for each action class that uses this pattern, you can write it once as a wildcard mapping.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><action name="*Crud" class="example.Crud" method="{1}"> + ... +</pre> +</div></div><p>Here, a reference to "editCrud" will call the <code>edit</code> method on an instance of the Crud Action class. Likewise, a reference to "deleteCrud" will call the <code>delete</code> method instead.</p><p>Another common approach is to postfix the method name and set it off with an exclamation point (aka "bang"), underscore, or other special character.</p><ul><li>"action=Crud_input"</li><li>"action=Crud_delete"</li></ul><p>To use a postfix wildcard, just move the asterisk and add an underscore.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><action name="Crud_*" class="example.Crud" method="{1}"> +</pre> +</div></div><p>From the framework's perspective, a wildcard mapping creates a new "virtual" mapping with all the same attributes as a conventional, static mapping. As a result, you can use the expanded wildcard name as the name of validation, type conversion, and message resource files, just as if it were an Action name (which it is!).</p><ul><li><code>Crud_input-validation.xml</code></li><li><code>Crud_delete-conversion.xml</code></li></ul><div class="confluence-information-macro confluence-information-macro-warning"><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If Wildcard Method mapping uses a "!" in the action name, the Wildcard Method will overlap with another flexible approach to mapping, <a shape="rect" href="action-configuration.html">Dynamic Method Invocation</a>. To use action names that include the "!" character, set <code>struts.enable.DynamicMethodInvocation</code> to < code>FALSE</code> in the application configuration.</p></div></div><h2 id="ActionConfiguration-DynamicMethodInvocation">Dynamic Method Invocation</h2><p>There's a feature embedded in Struts 2 that lets the "!" (bang) character invoke a method other than <code>execute</code>. It is called "Dynamic Method Invocation" aka DMI.</p><p>DMI will use the string following a "!" character in an action name as the name of a method to invoke (instead of <code>execute</code>). A reference to "<code>Category!create.action</code>", says to use the "Category" action mapping, but call the <code>create</code> method instead.</p><p>Another way to use DMI is to provide HTTP parameters prefixed with "<code>method:</code>". For example in the URL it could be "<code>Category.action?method:create=foo</code>", the parameter value is ignored. In POST-Requests that can be used e.g. with a hidden parameter (<code><s:hidden name="method:create" value="foo" /></code>) or along with a button (<code><s:su bmit method="create" /></code>).</p><p>For Struts 2, we added a switch to disable DMI for two reasons. First, DMI can cause security issues if POJO actions are used. Second, DMI overlaps with the Wildcard Method feature that we brought over from Struts 1 (and from Cocoon before that). If you have security concerns, or would like to use the "!" character with Wildcard Method actions, then set <code>struts.enable.DynamicMethodInvocation</code> to <code>FALSE</code> in the application configuration.</p><p>The framework does support DMI, but there are problems with way DMI is implemented. Essentially, the code scans the action name for a "!" character, and finding one, tricks the framework into invoking the other method instead of <code>execute</code>. The other method is invoked, but it uses the same configuration as the <code>execute</code> method, including validations. The framework "believes" it is invoking the <code>Category</code> action with the <code>execute</code> method.</ p><p>The Wildcard Method feature is implemented differently. When a Wildcard Method action is invoked, the framework acts as if the matching action had been hardcoded in the configuration. The framework "believes" it's executing the action <code>Category!create</code> and "knows" it is executing the <code>create</code> method of the corresponding Action class. Accordingly, we can add for a Wildcard Method action mapping its own validations, message resources, and type converters, just like a conventional action mapping. For this reason, the <a shape="rect" href="action-configuration.html">Wildcard Method</a> is preferred.</p><h3 id="ActionConfiguration-StrictDMI">Strict DMI</h3><p>In Struts 2.3, an option was added to restrict the methods that DMI can invoke. First, set the attribute <code>strict-method-invocation="true"</code> on your <code><package></code> element. This tells Struts to reject any method that is not explicitly allowed via either the <code>method</code> attrib ute (including wildcards) or the <code><allowed-methods></code> tag. Then specify <code><allowed-methods></code> as a comma-separated list of method names in your <code><action></code>. (If you specify a <code>method</code> attribute for your action, you do not need to list it in <code><allowed-methods></code>.)</p><p>Note that you can specify <code><allowed-methods></code> even without <code>strict-method-invocation</code>. This restricts access only for the specific actions that have <code><allowed-methods></code>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Example struts.xml</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><?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> + + <constant name="struts.enable.DynamicMethodInvocation" value="true"/> + + <package name="default" extends="struts-default" strict-method-invocation="true"> + + <action name="index" class="org.apache.struts2.examples.actions.Index"> + <result name="success" type="redirectAction">hello</result> + </action> + + <action name="hello" class="org.apache.struts2.examples.actions.HelloAction"> + <result name="success">/WEB-INF/content/hello.jsp</result> + <result name="redisplay" type="redirectAction">hello</result> + <allowed-methods>add</allowed-methods> + </action> + + </package> +</struts> +</pre> +</div></div><h3 id="ActionConfiguration-StrictMethodInvocation">Strict Method Invocation</h3><p>In Struts 2.5 the Strict DMI was extended and it's called <strong>Strict Method Invocation</strong> aka SMI. You can imagine that the DMI is a "border police", where SMI is a "tax police" and keeps eye on internals. With this version, SMI is enabled by default (<code>strict-method-invocation</code> attribute is set to <code>true</code> by default in <code>struts-default</code> package), you have option to disable it per package - there is no global switch to disable SMI for the whole application. To gain advantage of new configuration option please use the latest DTD definition:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Struts 2.5 DTD</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE struts PUBLIC + "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" + "http://struts.apache.org/dtds/struts-2.5.dtd"> +<struts> +... +</struts></pre> +</div></div><p>SMI works in the following way:</p><ul style="list-style-type: square;"><li><code><allowed-methods></code> / <code>@AllowedMethods</code> is defined per action - SMI works without switching it on but just for those actions (plus adding <code><global-allowed-methods/></code>)</li><li>SMI is enabled but no <code><allowed-methods></code> / <code>@AllowedMethods</code> are defined - SMI works but only with <code><global-allowed-methods/></code></li><li><span style="line-height: 1.42857;">SMI is disabled - call to any action method is allowed that matches the default RegEx - <code>([A-Za-z0-9_$]*)</code></span></li></ul><p>You can redefine the default RegEx by using a constant as follow <code><constant name="struts.strictMethodInvocation.methodRegex" value="([a-zA-Z]*)"/></code></p><div class="confluence-information-macro confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>When using wildcard mapping in actions' definitions SMI works in two ways:</p><ul style="list-style-type: square;"><li>SMI is disabled - any wildcard will be substituted with the default RegEx, ie.: <code><action name="Person*" method="perform*"></code> will be translated into <code>allowedMethod = "regex:perform([A-Za-z0-9_$]*)".</code></li><li>SMI is enabled - no wildcard substitution will happen, you must strictly define which methods can be accessed by annotations or <code><allowed-method/></code> tag.</li></ul></div></div><p><span style="line-height: 1.42857;">You can configure SMI per <code><action/></code> using <code><allowed-methods/></code> tag or via <code>@AllowedMethod</code> annotation plus using per <code><package/></code> <code><global-allowed-methods/></code>, see the examples below:</span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>SMI via struts.xml</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><package ...> + ... + <global-allowed-methods>execute,input,back,cancel,browse</global-allowed-methods> + ... +  + <action name="Bar"> + <allowed-methods>foo,bar</allowed-methods> + </action> +  + ... +</package> + +</pre> +</div></div><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>SMI via annotation on action class level</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">@AllowedMethods("end") +public class ClassLevelAllowedMethodsAction { + public String execute() { + return ... + } +}</pre> +</div></div><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>SMI via annotation on package level (in package-info.java)</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">@org.apache.struts2.convention.annotation.AllowedMethods({"home", "start"}) +package org.apache.struts2.convention.actions.allowedmethods;</pre> +</div></div><p>Allowed methods can be defined as:</p><ul style="list-style-type: square;"><li><p>literals ie. in xml: <code>execute,cancel </code>or in annotation:<code> {"<code>execute</code>", "<code>cancel</code>"}<br clear="none"></code></p></li><li>patterns when using with wildcard mapping, i.e <code><action ... method="do{2}"/></code></li><li>RegExs using <code>regex:</code> prefix, ie: <code><global-allowed-methods>execute,input,cancel,regex:user([A-Z]*)</global-allowed-methods></code></li></ul><div class="confluence-information-macro confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Please be aware when using your own <code>Configurationprovider</code> that the logic to set allowed methods is defined in built-in providers - <code>XmlConfigurationProvider</code> and <code>PackageBasedActionConfigBuilder</code> - and you must replicate such logic in your code as by default only <code>execute</code> method is allowed, even when SMI is disabled.</p></div></div><h2 id="ActionConfiguration-ActionSupportDefault">ActionSupport Default</h2><p>If the class attribute in an action mapping is left blank, the <code>com.opensymphony.xwork2.ActionSupport</code> class is used as a default.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"><action name="Hello"> + // ... +</action> +</pre> +</div></div><p><img class="emoticon emoticon-information" src="https://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/information.png" data-emoticon-name="information" alt="(info)"> The ActionSupport class has an <code>execute</code> method that returns "success" and an <code>input</code> method that returns "input".<br clear="none"> <img class="emoticon emoticon-information" src="https://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/information.png" data-emoticon-name="information" alt="(info)"> To specify a different class as the default Action class, set the <code>default-class-ref</code> package attribute.</p><p><img class="emoticon emoticon-light-on" src="https://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/lightbulb_on.png" data-emoticon-name="light-on" alt="(lightbulb)"> For more about usin g wildcards, see <a shape="rect" href="wildcard-mappings.html">Wildcard Mappings</a>.</p><h2 id="ActionConfiguration-Post-BackDefault">Post-Back Default</h2><p>A good practice is to link to actions rather than pages. Linking to actions encapsulates which server page renders, and ensures that an Action class can fire before a page renders.</p><p>Another common workflow stategy is to first render a page using an alternate method, like <code>input</code> and then have it submit back to the default <code>execute</code> method.</p><p>Using these two strategies together creates an opportunity to use a "post-back" form that doesn't specify an action. The form simply submits back to the action that created it.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Posting Back</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"><s:form> + <s:textfield label="Please enter your name" name="name"/> + <s:submit/> +</s:form> +</pre> +</div></div><h2 id="ActionConfiguration-ActionDefault">Action Default</h2><p>Usually, if an action is requested, and the framework can't map the request to an action name, the result will be the usual "404 - Page not found" error. But, if you would prefer that an omnibus action handle any unmatched requests, you can specify a default action. If no other action matches, the default action is used instead.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><package name="Hello" extends="action-default"> + + <default-action-ref name="UnderConstruction"/> + + <action name="UnderConstruction"> + <result>/UnderConstruction.jsp</result> + </action> + + ... +</pre> +</div></div><p>There are no special requirements for the default action. Each package can have its own default action, but there should only be one default action per namespace.</p><div class="confluence-information-macro confluence-information-macro-warning"><p class="title">One to a Namespace</p><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>The default action features should be set up so that there is only one default action per namespace. If you have multiple packages declaring a default action with the same namespace, there is no guarantee which action will be the default.</p></div></div><h3 id="ActionConfiguration-WildcardDefault">Wildcard Default</h3><p>Using wildcards is another approach to default actions. A wildcard action at the end of the configuration can be used to catch unmatched references.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeCont ent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><action name="*"> + <result>/{1}.jsp</result> +</action> +</pre> +</div></div><p>When a new action is needed, just add a stub page.</p><p><img class="emoticon emoticon-warning" src="https://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/warning.png" data-emoticon-name="warning" alt="(warning)"> It's important to put a "catchall" wildcard mapping like this at the end of your configuration so it won't attempt to map every request!</p><h2 id="ActionConfiguration-Next:">Next: <a shape="rect" href="wildcard-mappings.html">Wildcard Mappings</a></h2></div> + </div> + + + </div> +</div> +<div class="footer"> + Generated by CXF SiteExporter +</div> +</body> +</html> http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/action-mapper-action-mapping.html ---------------------------------------------------------------------- diff --git a/content/docs/action-mapper-action-mapping.html b/content/docs/action-mapper-action-mapping.html new file mode 100644 index 0000000..4ddf1be --- /dev/null +++ b/content/docs/action-mapper-action-mapping.html @@ -0,0 +1,179 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!-- +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. +--> +<html> +<head> + <link type="text/css" rel="stylesheet" href="https://struts.apache.org/css/default.css"> + <style type="text/css"> + .dp-highlighter { + width:95% !important; + } + </style> + <style type="text/css"> + .footer { + background-image: url('https://cwiki.apache.org/confluence/images/border/border_bottom.gif'); + background-repeat: repeat-x; + background-position: left top; + padding-top: 4px; + color: #666; + } + </style> + <link href='https://struts.apache.org/highlighter/style/shCoreStruts.css' rel='stylesheet' type='text/css' /> + <link href='https://struts.apache.org/highlighter/style/shThemeStruts.css' rel='stylesheet' type='text/css' /> + <script src='https://struts.apache.org/highlighter/js/shCore.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushPlain.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushXml.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJava.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJScript.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushGroovy.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushBash.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushCss.js' type='text/javascript'></script> + <script type="text/javascript"> + SyntaxHighlighter.defaults['toolbar'] = false; + SyntaxHighlighter.all(); + </script> + <script type="text/javascript" language="javascript"> + var hide = null; + var show = null; + var children = null; + + function init() { + /* Search form initialization */ + var form = document.forms['search']; + if (form != null) { + form.elements['domains'].value = location.hostname; + form.elements['sitesearch'].value = location.hostname; + } + + /* Children initialization */ + hide = document.getElementById('hide'); + show = document.getElementById('show'); + children = document.all != null ? + document.all['children'] : + document.getElementById('children'); + if (children != null) { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + } + + function showChildren() { + children.style.display = 'block'; + show.style.display = 'none'; + hide.style.display = 'inline'; + } + + function hideChildren() { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + </script> + <title>Action Mapper & Action Mapping</title> +</head> +<body onload="init()"> +<table border="0" cellpadding="2" cellspacing="0" width="100%"> + <tr class="topBar"> + <td align="left" valign="middle" class="topBarDiv" align="left" nowrap> + <a href="home.html">Home</a> > <a href="guides.html">Guides</a> > <a href="core-developers-guide.html">Core Developers Guide</a> > <a href="action-mapper-action-mapping.html">Action Mapper & Action Mapping</a> + </td> + <td align="right" valign="middle" nowrap> + <form name="search" action="https://www.google.com/search" method="get"> + <input type="hidden" name="ie" value="UTF-8" /> + <input type="hidden" name="oe" value="UTF-8" /> + <input type="hidden" name="domains" value="" /> + <input type="hidden" name="sitesearch" value="" /> + <input type="text" name="q" maxlength="255" value="" /> + <input type="submit" name="btnG" value="Google Search" /> + </form> + </td> + </tr> +</table> + +<div id="PageContent"> + <div class="pageheader" style="padding: 6px 0px 0px 0px;"> + <!-- We'll enable this once we figure out how to access (and save) the logo resource --> + <!--img src="/wiki/images/confluence_logo.gif" style="float: left; margin: 4px 4px 4px 10px;" border="0"--> + <div style="margin: 0px 10px 0px 10px" class="smalltext">Apache Struts 2 Documentation</div> + <div style="margin: 0px 10px 8px 10px" class="pagetitle">Action Mapper & Action Mapping</div> + + <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=27473"> + <img src="https://cwiki.apache.org/confluence/images/icons/notep_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Edit Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=27473">Edit Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW"> + <img src="https://cwiki.apache.org/confluence/images/icons/browse_space.gif" + height="16" width="16" border="0" align="absmiddle" title="Browse Space"></a> + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW">Browse Space</a> + + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=27473"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_page_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=27473">Add Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=27473"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_blogentry_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add News"></a> + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=27473">Add News</a> + </div> + </div> + + <div class="pagecontent"> + <div class="wiki-content"> + <div id="ConfluenceContent"><p>The ActionMapper fetches the ActionMapping object corresponding to a given request. Essentially, the ActionMapping is a data transfer object that collects together details such as the Action class and method to execute. The mapping is utilized by the Dispatcher and various user interface components. It is customizable through <code>struts.mapper.class</code> entry in <code>struts.properties</code>.</p> + +<h2 id="ActionMapper&ActionMapping-Customize">Customize</h2> + +<div class="confluence-information-macro confluence-information-macro-warning"><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Custom ActionMapper must implement ActionMapper interface and have a default constructor.</p></div></div> + +<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"> +struts.mapper.class=foo.bar.MyCustomActionMapper +</pre> +</div></div> + +<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"> +public class MyCustomActionMapper implements ActionMapper { + public ActionMapping getMapping(HttpServletRequest request, + ConfigurationManager configManager) { + .... + } + + public String getUriFromActionMapping(ActionMapping mapping) { + .... + } +} +</pre> +</div></div> + +<h2 id="ActionMapper&ActionMapping-Next:">Next: <a shape="rect" href="action-proxy-actionproxy-factory.html">Action Proxy & ActionProxy Factory</a></h2></div> + </div> + + + </div> +</div> +<div class="footer"> + Generated by CXF SiteExporter +</div> +</body> +</html>