http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/core-developers-guide.html ---------------------------------------------------------------------- diff --git a/content/docs/core-developers-guide.html b/content/docs/core-developers-guide.html new file mode 100644 index 0000000..080595d --- /dev/null +++ b/content/docs/core-developers-guide.html @@ -0,0 +1,255 @@ +<!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> + <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>Core Developers Guide</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> + </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">Core Developers Guide</div> + + <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=13945"> + <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=13945">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=13945"> + <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=13945">Add Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=13945"> + <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=13945">Add News</a> + </div> + </div> + + <div class="pagecontent"> + <div class="wiki-content"> + <div id="ConfluenceContent"><p>Struts 2 processes requests using three core types: <a shape="rect" href="interceptor-configuration.html">interceptors</a>, <a shape="rect" href="action-configuration.html">actions</a>, and <a shape="rect" href="result-configuration.html">results</a>. Each may be configured via XML or annotations.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><td colspan="1" rowspan="1" class="confluenceTd"><ul><li>Developing Applications with Struts 2<ul><li><a shape="rect" href="nutshell.html">Nutshell</a></li><li><a shape="rect" href="ajax.html">AJAX</a></li><li><a shape="rect" href="dependency-injection.html">Dependency Injection</a></li><li><a shape="rect" href="profiling.html">Profiling</a></li><li><a shape="rect" href="debugging.html">Debugging</a></li><li><a shape="rect" href="devmode.html">Development Mode</a></li></ul></li><li>Configuration<ul><li><a shape="rect" href="convention-plugin.html">Configuration by Convention</a>< /li><li><a shape="rect" href="annotations.html">Annotations</a></li><li><a shape="rect" href="configuration-elements.html">Configuration Elements</a><ul><li><a shape="rect" href="action-configuration.html">Actions</a>, <a shape="rect" href="wildcard-mappings.html">Wildcard Mappings</a>, <a shape="rect" href="bean-configuration.html">Beans</a>, <a shape="rect" href="constant-configuration.html">Constants</a></li><li><a shape="rect" href="exception-configuration.html">Exceptions</a>, <a shape="rect" href="include-configuration.html">Includes</a>, <a shape="rect" href="interceptor-configuration.html">Interceptors</a></li><li><a shape="rect" href="namespace-configuration.html">Namespaces</a>, <a shape="rect" href="package-configuration.html">Packages</a>, <a shape="rect" href="result-configuration.html">Results</a></li><li><a shape="rect" href="unknown-handlers.html">Unknown Handlers</a>, <a shape="rect" href="dispatcher.html">Dispatcher</a></li></ul></li><li><a shape="rect" href="confi guration-files.html">Configuration Files</a><ul><li><a shape="rect" href="webxml.html">web.xml</a></li><li><a shape="rect" href="strutsxml.html">struts.xml</a></li><li><a shape="rect" href="strutsproperties.html">struts.properties</a></li><li><a shape="rect" href="struts-defaultxml.html">struts-default.xml</a></li><li><a shape="rect" href="velocityproperties.html">velocity.properties</a></li><li><a shape="rect" href="struts-defaultvm.html">struts-default.vm</a></li></ul></li><li><a shape="rect" href="application-servers.html">Application Servers</a></li><li><a shape="rect" href="performance-tuning.html">Performance Tuning</a></li></ul></li><li><img class="emoticon emoticon-light-on" src="https://cwiki.apache.org/confluence/s/en_GB/5997/6f42626d00e36f53fe51440403446ca61552e2a2.1/_/images/icons/emoticons/lightbulb_on.png" data-emoticon-name="light-on" alt="(lightbulb)"><a shape="rect" href="security.html">Security</a></li></ul></td><td colspan="1" rowspan="1" class="confluenceTd"><ul> <li><a shape="rect" href="testing-actions.html">Testing Actions</a><ul><li><a shape="rect" class="external-link" href="https://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/" rel="nofollow">(arsenalist)</a></li><li><a shape="rect" class="external-link" href="http://fassisrosa.blogspot.com/2006/11/unit-testing-struts-20.html" rel="nofollow">(rosa)</a></li></ul></li><li><a shape="rect" href="interceptors.html">Interceptors</a><ul><li><a shape="rect" href="writing-interceptors.html">Writing Interceptors</a></li><li><a shape="rect" href="parameters-interceptor.html">Excluding Parameters</a></li></ul></li><li>Actions<ul><li><a shape="rect" href="model-driven.html">Model Driven</a></li><li><a shape="rect" href="action-chaining.html">Action Chaining</a></li><li><a shape="rect" href="actioneventlistener.html">ActionEventListener</a></li></ul></li><li>Results<ul><li><a shape="rect" href="result-types.html">Result Types</a></li><li><a shape="rect" hre f="dispatcherlistener.html">DispatcherListener</a></li><li><a shape="rect" href="preresultlistener.html">PreResultListener</a></li></ul></li><li><a shape="rect" href="validation.html">Validation</a></li><li><a shape="rect" href="localization.html">Localization</a><ul><li><a shape="rect" href="formatting-dates-and-numbers.html">Formatting Dates and Numbers</a></li></ul></li><li><a shape="rect" href="type-conversion.html">Type Conversion</a></li><li><a shape="rect" href="static-content.html">Static Content</a></li><li>Portlets<ul><li><a shape="rect" href="struts-2-portlet-tutorial.html">Tutorial</a></li><li><a shape="rect" href="portlet-plugin.html">Configuration/Documentation</a></li></ul></li><li><a shape="rect" href="logging.html">Logging</a></li><li><a shape="rect" href="faqs.html">FAQs</a><ul><li><a shape="rect" href="struts-2-maven-archetypes.html">Struts 2 Maven Archetypes</a></li><li><a shape="rect" href="cookbook.html">Cookbook</a></li></ul></li><li><a shape="rect" class="ext ernal-link" href="http://struts.apache.org/maven/struts2-core/apidocs/index.html">Javadoc APIs</a></li></ul></td></tr></tbody></table></div><h2 id="CoreDevelopersGuide-Next:">Next: <a shape="rect" href="tag-developers-guide.html">Tag Developers Guide</a></h2></div> + </div> + + <div class="tabletitle"> + Children + <span class="smalltext" id="show" style="display: inline;"> + <a href="javascript:showChildren()">Show Children</a></span> + <span class="smalltext" id="hide" style="display: none;"> + <a href="javascript:hideChildren()">Hide Children</a></span> + </div> + <div class="greybox" id="children" style="display: none;"> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + </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/create-action.html ---------------------------------------------------------------------- diff --git a/content/docs/create-action.html b/content/docs/create-action.html new file mode 100644 index 0000000..746bb4e --- /dev/null +++ b/content/docs/create-action.html @@ -0,0 +1,172 @@ +<!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> + <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>Create Action</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="contributors-guide.html">Contributors Guide</a> > <a href="requirements.html">Requirements</a> > <a href="use-cases.html">Use Cases</a> > <a href="create-action.html">Create Action</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">Create Action</div> + + <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=29367"> + <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=29367">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=29367"> + <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=29367">Add Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=29367"> + <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=29367">Add News</a> + </div> + </div> + + <div class="pagecontent"> + <div class="wiki-content"> + <div id="ConfluenceContent"><h2 id="CreateAction-Narrative">Narrative</h2> + + + +<h2 id="CreateAction-Goal">Goal</h2> + +<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Goal </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> Create Action</p></td></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Level </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> User Goal </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> (User Goal, Summary, Subfunction) </p></td></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Trigger </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> Use Case </p></td></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Primary Actor </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> Developer </p></td></tr></tbody></table></div> + + +<h2 id="CreateAction-MainSuccessScenario(MSS)">Main Success Scenario (MSS)</h2> + +<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Step </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Action </p></th></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> 1 </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> Create class that implements Action interface. </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <img class="emoticon emoticon-plus" src="https://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/add.png" data-emoticon-name="plus" alt="(plus)"> </p></td></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> 2 </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> Implement <code>execute</code> method to realize the Action's goal. </p></td></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> 3 </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> Define other me thods as needed. </p></td></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> 4 </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> Define Mapping to invoke Action. </p></td></tr></tbody></table></div> + + +<h2 id="CreateAction-Extensions">Extensions <img class="emoticon emoticon-plus" src="https://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/add.png" data-emoticon-name="plus" alt="(plus)"></h2> + +<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Step </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Branching Action </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> 1a </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Utilize base class </p></th></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> .1 </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> Create class that extends ActionSupport class (or equivalent). </p></td></tr></tbody></table></div> + + +<hr> + +<h2 id="CreateAction-PreconditionsandGuarantees">Preconditions and Guarantees</h2> + +<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Preconditions </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Minimal Guarantees </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Success Guarantees </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr></tbody></table></div> + + +<h2 id="CreateAction-StakeholdersandInterests">Stakeholders and Interests</h2> + +<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Stakeholder </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Interest </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr></tbody></table></div> + + +<h2 id="CreateAction-Variations">Variations </h2> + +<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Step </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Variation </p></th></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr></tbody></table></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/create-session-interceptor.html ---------------------------------------------------------------------- diff --git a/content/docs/create-session-interceptor.html b/content/docs/create-session-interceptor.html new file mode 100644 index 0000000..ea22a66 --- /dev/null +++ b/content/docs/create-session-interceptor.html @@ -0,0 +1,187 @@ +<!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>Create Session Interceptor</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="interceptors.html">Interceptors</a> > <a href="create-session-interceptor.html">Create Session Interceptor</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">Create Session Interceptor</div> + + <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=13992"> + <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=13992">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=13992"> + <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=13992">Add Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=13992"> + <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=13992">Add News</a> + </div> + </div> + + <div class="pagecontent"> + <div class="wiki-content"> + <div id="ConfluenceContent"> +<p></p><p> +This interceptor creates the HttpSession if it doesn't exist, also SessionMap is recreated and put in ServletActionContext. +</p> + +<p></p><p> +This is particular useful when using the <@s.token> tag in freemarker templates. +The tag <b>do</b> require that a HttpSession is already created since freemarker commits +the response to the client immediately. +</p> + +<h2 id="CreateSessionInterceptor-Parameters">Parameters</h2> + + +<p></p><ul><li>None</li></ul> + + +<h2 id="CreateSessionInterceptor-ExtendingtheInterceptor">Extending the Interceptor</h2> + + +<p></p><ul><li>None</li></ul> + + +<h2 id="CreateSessionInterceptor-Examples">Examples</h2> + +<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[ + +<action name="someAction" class="com.examples.SomeAction"> + <interceptor-ref name="createSession"/> + <interceptor-ref name="defaultStack"/> + <result name="input">input_with_token_tag.ftl</result> +</action> + +]]></script> +</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/create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.data/Basic_Struts2_Mvn.png ---------------------------------------------------------------------- diff --git a/content/docs/create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.data/Basic_Struts2_Mvn.png b/content/docs/create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.data/Basic_Struts2_Mvn.png new file mode 100644 index 0000000..4b2bdb3 Binary files /dev/null and b/content/docs/create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.data/Basic_Struts2_Mvn.png differ http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.html ---------------------------------------------------------------------- diff --git a/content/docs/create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.html b/content/docs/create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.html new file mode 100644 index 0000000..3627f9f --- /dev/null +++ b/content/docs/create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.html @@ -0,0 +1,237 @@ +<!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>Create Struts 2 Web Application Using Maven To Manage Artifacts and To Build The Application</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="tutorials.html">Tutorials</a> > <a href="getting-started.html">Getting Started</a> > <a href="how-to-create-a-struts-2-web-application.html">How To Create A Struts 2 Web Application</a> > <a href="create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.html">Create Struts 2 Web Application Using Maven To Manage Artifacts and To Build The Application</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">Create Struts 2 Web Application Using Maven To Manage Artifacts and To Build The Application</div> + + <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14811868"> + <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=14811868">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=14811868"> + <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=14811868">Add Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14811868"> + <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=14811868">Add News</a> + </div> + </div> + + <div class="pagecontent"> + <div class="wiki-content"> + <div id="ConfluenceContent"><p>You can checkout this complete example project (and all the other Getting Started tutorial example projects) from the Struts 2 GitHub repository at <a shape="rect" class="external-link" href="https://github.com/apache/struts-examples" rel="nofollow">https://github.com/apache/struts-examples</a>. The example projects use Maven to manage the artifact dependencies and to build the .war files.</p><div class="confluence-information-macro confluence-information-macro-information"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>This tutorial assumes you know how to create a Java web application that uses Maven to manage artifacts and build the web application archive (war) file.</p></div></div><h3 id="CreateStruts2WebApplicationUsingMavenToManageArtifactsandToBuildTheApplication-Step1-CreateAJavaWebApplication">Step 1 - Create A Java Web Applica tion</h3><p>In your Java IDE create a Java web application with a project name of basic_struts that follows the standard Maven project folder structure. In your pom.xml include the following:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>pom.xml build node</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"> <build> + <finalName>basic_struts</finalName> + </build> +</pre> +</div></div><h3 id="CreateStruts2WebApplicationUsingMavenToManageArtifactsandToBuildTheApplication-Step2-Addindex.jsp">Step 2 - Add index.jsp</h3><p>Our next step is to add a simple index.jsp to this web application. Create an index.jsp under src/main/webapp with a title of "Basic Struts 2 Application - Welcome" and in the body add an h1 heading of "Welcome to Struts 2!"</p><p>Run mvn clean package to create the war file. Copy the war file into your Servlet container so that it will deploy the war file.</p><p>Start up your Servlet container and in a web browser go to <a shape="rect" class="external-link" href="http://localhost:8080/Basic_Struts2_Mvn/index.jsp" rel="nofollow">http://localhost:8080/Basic_Struts2_Mvn/index.jsp</a>. You should see the following:</p><p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.data/Basic_Struts2_Mvn.png"></span></p ><h3 >id="CreateStruts2WebApplicationUsingMavenToManageArtifactsandToBuildTheApplication-Step3-AddStruts2JarFilesToClassPath">Step > 3 - Add Struts 2 Jar Files To Class Path</h3><p>Now that we know we have a >working Java web application, lets add the minimal required Struts 2 >framework Jar files to our web application's class path. In pom.xml add the >following dependency node:</p><div class="code panel pdl" >style="border-width: 1px;"><div class="codeHeader panelHeader pdl" >style="border-bottom-width: 1px;"><b>pom.xml dependency node</b></div><div >class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><dependency> + <groupId>org.apache.struts</groupId> + <artifactId>struts2-core</artifactId> + <version>X.X.X.X</version> +</dependency> + +</pre> +</div></div><p>Of course replace the X.X.X.X with the current Struts 2 version. Maven will get the struts2-core jar and the other jar files struts2-core requires (transitive dependencies). (NOTE: Beginning with Struts version 2.2.3 you do not need to specify a separate dependency node for javassist.)</p><h3 id="CreateStruts2WebApplicationUsingMavenToManageArtifactsandToBuildTheApplication-Step4-AddLogging">Step 4 - Add Logging</h3><p>To see what's happening under the hood, the example application for this tutorial uses log4j. You'll need to add to pom.xml a dependency node for the log4j jar file:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>pom.xml log4j dependency node</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.14</version> +</dependency> +</pre> +</div></div><p>Setup a log4j.xml configuration in the src/main/resources folder. You can copy the one from the example application, which contains the following</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>log4j.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 log4j:configuration PUBLIC "-//log4j/log4j Configuration//EN" "log4j.dtd"> + +<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> + + <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender"> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d %-5p %c.%M:%L - %m%n"/> + </layout> + </appender> + + <!-- specify the logging level for loggers from other libraries --> + <logger name="com.opensymphony"> + <level value="DEBUG" /> + </logger> + + <logger name="org.apache.struts2"> + <level value="DEBUG" /> + </logger> + + <!-- for all other loggers log only info and above log messages --> + <root> + <priority value="INFO"/> + <appender-ref ref="STDOUT" /> + </root> + +</log4j:configuration> +</pre> +</div></div><p>Note the above log4j configuration specifies the console as the log target.</p><h3 id="CreateStruts2WebApplicationUsingMavenToManageArtifactsandToBuildTheApplication-Step5-AddStruts2ServletFilter">Step 5 - Add Struts 2 Servlet Filter</h3><p>To enable the Struts 2 framework to work with your web application you need to add a Servlet filter class and filter mapping to web.xml. Below is the filter and filter-mapping nodes you should add to web.xml.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>web.xml Servlet Filter</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"><filter> + <filter-name>struts2</filter-name> + <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> +</filter> + +<filter-mapping> + <filter-name>struts2</filter-name> + <url-pattern>/*</url-pattern> +</filter-mapping> +</pre> +</div></div><p>For more information about configuring the deployment descriptor for Struts 2 see <a shape="rect" href="webxml.html">web.xml</a>. Note the url-pattern node value is /* meaning the Struts 2 filter will be applied to all URLs for this web application.</p><h3 id="CreateStruts2WebApplicationUsingMavenToManageArtifactsandToBuildTheApplication-Step6-Createstruts.xml">Step 6 - Create struts.xml</h3><p>Struts 2 can use either an XML configuration file or annotations (or both) to specify the relationship between a URL, a Java class, and a view page (such as index.jsp). For our basic Struts 2 application, we'll use a minimal xml configuration. Note the file name is struts.xml and it should be in the src/main/resources folder (struts.xml must be on the web application's root class path).</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>struts.xml</b></div><div class="codeContent panelContent pd l"> +<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.0//EN" + "http://struts.apache.org/dtds/struts-2.0.dtd"> + +<struts> + + <constant name="struts.devMode" value="true" /> + + <package name="basicstruts2" extends="struts-default"> + + <action name="index"> + <result>/index.jsp</result> + </action> + + </package> + +</struts> +</pre> +</div></div><p>This minimal Struts 2 configuration file tells the framework that if the URL ends in index.action to redirect the browser to index.jsp.</p><p>For more information about the struts.xml configuration file see <a shape="rect" href="strutsxml.html">struts.xml</a>.</p><h3 id="CreateStruts2WebApplicationUsingMavenToManageArtifactsandToBuildTheApplication-Step7-BuildandRuntheApplication">Step 7 - Build and Run the Application</h3><p>With all of the above in place run mvn clean package to create the war file. Remove the previously created war file and exploded web application folder from your Servlet container's webapps folder. Copy to your Servlet container's webapps folder the new war you just created.</p><p>Start up the Servlet container. View the console where you should see numerous debug messages that tell you the Struts 2 framework is being included in the Basic_Struts2_Mvn web application.</p><p>Open a web browser and go to <a shape="rect" class="external-link" href=" http://localhost:8080/Basic_Struts2_Mvn/index.action" rel="nofollow">http://localhost:8080/Basic_Struts2_Mvn/index.action</a> (note that's index.action not index.jsp at the end of the URL). You should see the same web page as when going to <a shape="rect" class="external-link" href="http://localhost:8080/Basic_Struts2_Mvn/index.jsp" rel="nofollow">http://localhost:8080/Basic_Struts2_Mvn/index.jsp</a>. View the log messages written to the console and you should find several that discuss index.action and index.jsp:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Struts 2 Log Messages</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">com.opensymphony.xwork2.DefaultActionProxy.debug:57 - Creating an DefaultActionProxy for namespace / and action name index +... +org.apache.struts2.dispatcher.ServletDispatcherResult.debug:57 - Forwarding to location /index.jsp +</pre> +</div></div><p>Note that the xwork2 artifact is one of the Jar files that is a transitive dependency for the struts2-core Jar file. The xwork2 library is used heavily by the Struts 2 framework.</p><h3 id="CreateStruts2WebApplicationUsingMavenToManageArtifactsandToBuildTheApplication-GettingHelp">Getting Help</h3><p>The <a shape="rect" class="external-link" href="http://struts.apache.org/mail.html">Struts 2 user mailing list</a> is an excellent place to get help. If you are having a problem getting this Basic Struts 2 application to work search the Struts 2 mailing list. If you don't find an answer to your problem, post a question on the mailing list.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Next</p></th><td colspan="1" rowspan="1" class="confluenceTd"><p>Onward to <a shape="rect" href="hello-world-using-struts-2.html">Hello World Using Struts 2</a></p></td></tr><tr><th colspan="1" rowspan="1" class="conf luenceTh"><p>Prev</p></th><td colspan="1" rowspan="1" class="confluenceTd"><p>Return to <a shape="rect" href="tutorials.html">Tutorials</a></p></td></tr></tbody></table></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/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.data/Basic_Strut2_Ant_Structure.png ---------------------------------------------------------------------- diff --git a/content/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.data/Basic_Strut2_Ant_Structure.png b/content/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.data/Basic_Strut2_Ant_Structure.png new file mode 100644 index 0000000..096c54e Binary files /dev/null and b/content/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.data/Basic_Strut2_Ant_Structure.png differ http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.data/Basic_Struts2_Welcome.png ---------------------------------------------------------------------- diff --git a/content/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.data/Basic_Struts2_Welcome.png b/content/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.data/Basic_Struts2_Welcome.png new file mode 100644 index 0000000..a31fd34 Binary files /dev/null and b/content/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.data/Basic_Struts2_Welcome.png differ http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.html ---------------------------------------------------------------------- diff --git a/content/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.html b/content/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.html new file mode 100644 index 0000000..58e1a5c --- /dev/null +++ b/content/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.html @@ -0,0 +1,312 @@ +<!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>Create Struts 2 Web Application With Artifacts In WEB-INF lib and Use Ant To Build The Application</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="tutorials.html">Tutorials</a> > <a href="getting-started.html">Getting Started</a> > <a href="how-to-create-a-struts-2-web-application.html">How To Create A Struts 2 Web Application</a> > <a href="create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.html">Create Struts 2 Web Application With Artifacts In WEB-INF lib and Use Ant To Build The Application</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">Create Struts 2 Web Application With Artifacts In WEB-INF lib and Use Ant To Build The Application</div> + + <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14811863"> + <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=14811863">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=14811863"> + <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=14811863">Add Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14811863"> + <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=14811863">Add News</a> + </div> + </div> + + <div class="pagecontent"> + <div class="wiki-content"> + <div id="ConfluenceContent"><p>You can download this complete example, Basic_Struts2_Ant, from Google Code - <a shape="rect" class="external-link" href="http://code.google.com/p/struts2-examples/downloads/list" rel="nofollow">http://code.google.com/p/struts2-examples/downloads/list</a>. Click on the link for Basic_Struts2_Ant.zip and save the file to your computer. Unzip the file and you should have a folder named Basic_Struts2_Ant. In that folder is a README.txt file with instruction on how to build and run the application.</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>This tutorial assumes you already know how to create a Java web application, use Ant to build the web application archive (war) file, and deploy the war file to a Servlet container such as Tomcat or Jetty.</p></div></div> + +<p>To create a Struts 2 web application with the Struts 2 artifacts added to the the application's class path manually you will need to download the Struts 2 distribution from the <a shape="rect" class="external-link" href="http://struts.apache.org/downloads.html">Apache Struts website</a>.</p> + +<p>On the Struts 2 download page, click on the link for the current General Availability release. In that release's section you'll find several links. To get started with a basic Struts 2 web application you need to only download the Essential Dependencies Only zip file, which is approximately 12mb.</p> + +<p>After downloading this zip file, unzip it. You should have a folder named the same as the current general availability release and in that folder will be a lib folder. The lib folder contains the Struts 2 jar files (e.g. struts2-core-X.X.X.X.jar, where X.X.X.X is the version) and other jar files Struts 2 requires (e.g. xwork-core.X.X.X.jar).</p> + +<p>As we create our basic Struts 2 web application we will copy from the Struts 2 distribution lib folder just the jar files our application requires. As we add features to our application in future tutorials we will copy other jar files.</p> + +<h3 id="CreateStruts2WebApplicationWithArtifactsInWEB-INFlibandUseAntToBuildTheApplication-Step1-CreateABasicJavaWebApplication">Step 1 - Create A Basic Java Web Application</h3> +<p>In your Java IDE create a web application project named Basic_Struts2_Ant. To follow along with this tutorial your web application should have the following folder structure:</p> + +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.data/Basic_Strut2_Ant_Structure.png"></span> </p> + +<p>Remember Struts 2 requires Servlet API 2.4 or higher, JSP 2.0 or higher, and Java 5 or higher. The example project, Basic_Struts2_Ant, which you can download from Google code <a shape="rect" class="external-link" href="http://code.google.com/p/struts2-examples/downloads/list" rel="nofollow">http://code.google.com/p/struts2-examples/downloads/list</a> was created using Eclipse 3.5 with Java 6.</p> + +<h3 id="CreateStruts2WebApplicationWithArtifactsInWEB-INFlibandUseAntToBuildTheApplication-Step2-Addindex.jspandAntBuildFile">Step 2 - Add index.jsp and Ant Build File</h3> +<p>Our next step is to add a simple index.jsp to this web application. Create an index.jsp under WebContent with a title of "Basic Struts 2 Application - Welcome" and in the body add an h1 heading of "Welcome to Struts 2!"</p> + +<p>Next create an Ant build.xml file that will compile any Java classes and create the war file. The code example download, Basic_Struts2_Ant, includes an Ant build.xml.</p> + +<p>Run the Ant target that creates the war file (in the example downloaded that is the archive target, which places the war file in the dist folder). Copy the war file into your Servlet container so that it will deploy the war file. </p> + +<p>Start up your Servlet container and in a web browser go to <a shape="rect" class="external-link" href="http://localhost:8080/Basic_Struts2_Ant/index.jsp" rel="nofollow">http://localhost:8080/Basic_Struts2_Ant/index.jsp</a>. You should see the following:</p> + +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.data/Basic_Struts2_Welcome.png"></span></p> + +<h3 id="CreateStruts2WebApplicationWithArtifactsInWEB-INFlibandUseAntToBuildTheApplication-Step3-AddStruts2JarFilesToClassPath">Step 3 - Add Struts 2 Jar Files To Class Path</h3> +<p>Now that we know we have a working Java web application, lets add the minimal required Struts 2 framework Jar files to our web application's class path. We'll copy these Jar files from the lib folder of the Struts 2 download to the WEB-INF/lib folder in our web application.</p> + +<p>Find and copy to WEB-INF\lib these files (note X.X.X.X.jar refers to the version number):</p> + +<ol><li>asm-x.x.jar</li><li>asm-commons-x.x.jar</li><li>asm-tree-x.x.jar</li><li>commons-io-X.X.X.jar</li><li>commons-lang3-X.X.X.jar</li><li>commons-fileupload-X.X.X.jar</li><li>freemarker-X.X.X.jar</li><li>javassist-X.X.X.jar</li><li>ognl-X.X.X.jar</li><li>struts2-core-X.X.X.X.jar</li><li>xwork-core-X.X.X.jar</li></ol> + + + +<p>You can see from the above that the Struts 2 core jar depends on several other artifacts. As we add additional Struts 2 features in future tutorials, we'll need to add additional Struts 2 jar files and other transitive dependencies.</p> + +<h3 id="CreateStruts2WebApplicationWithArtifactsInWEB-INFlibandUseAntToBuildTheApplication-Step4-AddLogging">Step 4 - Add Logging</h3> +<p>To see what's happening under the hood, the example application for this tutorial uses log4j. You'll need to download the log4j jar file and copy it to WEB-INF/lib. The example application uses log4j-1.2.14.jar <a shape="rect" class="external-link" href="http://archive.apache.org/dist/logging/log4j/1.2.14/">http://archive.apache.org/dist/logging/log4j/1.2.14/</a>.</p> + +<p>Setup a log4j.xml configuration in the src folder. You can copy the one from the example application, which contains the following</p> + +<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>log4j.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 log4j:configuration PUBLIC "-//log4j/log4j Configuration//EN" "log4j.dtd"> + +<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> + + <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender"> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d %-5p %c.%M:%L - %m%n"/> + </layout> + </appender> + + <!-- specify the logging level for loggers from other libraries --> + <logger name="com.opensymphony"> + <level value="DEBUG" /> + </logger> + + <logger name="org.apache.struts2"> + <level value="DEBUG" /> + </logger> + + <!-- for all other loggers log only debug and above log messages --> + <root> + <priority value="INFO"/> + <appender-ref ref="STDOUT" /> + </root> + +</log4j:configuration> +</pre> +</div></div> +<p>Note the above log4j configuration specifies the console as the log target. </p> + +<h3 id="CreateStruts2WebApplicationWithArtifactsInWEB-INFlibandUseAntToBuildTheApplication-Step5-AddStruts2ServletFilter">Step 5 - Add Struts 2 Servlet Filter</h3> +<p>To enable the Struts 2 framework to work with your web application you need to add a Servlet filter class and filter mapping to web.xml. Below is the filter and filter-mapping nodes you should add to web.xml.</p> + +<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>web.xml Servlet Filter</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"> +<filter> + <filter-name>struts2</filter-name> + <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> +</filter> + +<filter-mapping> + <filter-name>struts2</filter-name> + <url-pattern>/*</url-pattern> +</filter-mapping> +</pre> +</div></div> +<p>For more information about configuring the deployment descriptor for Struts 2 see <a shape="rect" href="webxml.html">web.xml</a>. Note the url-pattern node value is /* meaning the Struts 2 filter will be applied to all URLs for this web application.</p> + +<h3 id="CreateStruts2WebApplicationWithArtifactsInWEB-INFlibandUseAntToBuildTheApplication-Step6-Createstruts.xml">Step 6 - Create struts.xml</h3> +<p>Struts 2 can use either an XML configuration file or annotations (or both) to specify the relationship between a URL, a Java class, and a view page (such as index.jsp). For our basic Struts 2 application, we'll use a minimal xml configuration. Note the file name is struts.xml and it should be in the src folder (struts.xml must be on the web application's root class path).</p> + +<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>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.0//EN" + "http://struts.apache.org/dtds/struts-2.0.dtd"> + +<struts> + + <constant name="struts.devMode" value="true" /> + + <package name="basicstruts2" extends="struts-default"> + + <action name="index"> + <result>/index.jsp</result> + </action> + + </package> + +</struts> +</pre> +</div></div> +<p>This minimal Struts 2 configuration file tells the framework that if the URL ends in index.action to redirect the browser to index.jsp.</p> + +<p>For more information about the struts.xml configuration file see <a shape="rect" class="createlink" href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&title=XML&linkCreation=true&fromPageId=14811863">XML</a>.</p> + +<h3 id="CreateStruts2WebApplicationWithArtifactsInWEB-INFlibandUseAntToBuildTheApplication-Step7-BuildandRuntheApplication">Step 7 - Build and Run the Application</h3> +<p>With all of the above in place run the Ant target that creates the war file (in the example download that target is archive). Remove the previously created war file and exploded web application folder from your Servlet container's webapps folder. Copy to your Servlet container's webapps folder the new war you just created. </p> + +<p>Start up the Servlet container. View the console where you should see numerous debug messages that tell you the Struts 2 framework is being included in the Basic_Struts2_Ant web application.</p> + +<p>Open a web browser and go to <a shape="rect" class="external-link" href="http://localhost:8080/Basic_Struts2_Ant/index.action" rel="nofollow">http://localhost:8080/Basic_Struts2_Ant/index.action</a> (note that's index.action not index.jsp at the end of the URL). You should see the same web page as when going to <a shape="rect" class="external-link" href="http://localhost:8080/Basic_Struts2_Ant/index.jsp" rel="nofollow">http://localhost:8080/Basic_Struts2_Ant/index.jsp</a>. View the log messages written to the console and you should find several that discuss index.action and index.jsp:</p> + +<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Struts 2 Log Messages</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"> +com.opensymphony.xwork2.DefaultActionProxy.debug:57 - Creating an DefaultActionProxy for namespace / and action name index +... +org.apache.struts2.dispatcher.ServletDispatcherResult.debug:57 - Forwarding to location /index.jsp +</pre> +</div></div> +<p>Note that the xwork2 artifact is one of the Jar files we copied over to WEB-INF lib and is used heavily by the Struts 2 framework.</p> + +<h3 id="CreateStruts2WebApplicationWithArtifactsInWEB-INFlibandUseAntToBuildTheApplication-GettingHelp">Getting Help</h3> +<p>The <a shape="rect" class="external-link" href="http://struts.apache.org/mail.html">Struts 2 user mailing list</a> is an excellent place to get help. If you are having a problem getting this Basic Struts 2 application to work search the Struts 2 mailing list. If you don't find an answer to your problem, post a question on the mailing list. </p> + +<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Next </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> Onward to <a shape="rect" href="hello-world-using-struts-2.html">Hello World Using Struts 2</a> </p></td></tr><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Prev </p></th><td colspan="1" rowspan="1" class="confluenceTd"><p> Return to <a shape="rect" href="tutorials.html">Tutorials</a> </p></td></tr></tbody></table></div> + +</div> + </div> + + <div class="tabletitle"> + Children + <span class="smalltext" id="show" style="display: inline;"> + <a href="javascript:showChildren()">Show Children</a></span> + <span class="smalltext" id="hide" style="display: none;"> + <a href="javascript:hideChildren()">Hide Children</a></span> + </div> + <div class="greybox" id="children" style="display: none;"> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + </div> + + </div> +</div> +<div class="footer"> + Generated by CXF SiteExporter +</div> +</body> +</html>