[Struts Wiki] Update of "OpenWindowFromAction" by GarethEvans

2006-07-25 Thread Apache Wiki
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Struts Wiki" for change 
notification.

The following page has been changed by GarethEvans:
http://wiki.apache.org/struts/OpenWindowFromAction

--
 w = window.open("", "Results", "resizable,height=200,width=200");
 w.document.open();
 w.document.write(s);
-w.documenmt.close();
+w.document.close();
  }}}
  
  Imagine generating this in an Action, where the string "These are my results" 
is replaced by a full HTML page (properly escaped of course).  Yes, you could 
generated the response with a JSP, which is what I would recommend.  That might 
be confusing, so let me explain... a JSP does '''NOT''' have to render a 
complete HTML document.  It can instead render just a snippet of HTML, or just 
some Javascript, or just some comma-separated data, there is no limitation.  If 
you are doing AJAX, whatever is most appropriate can be done via JSPs (like XML 
too!).  This saved you from writing a lot of println's in your Actions to 
generate a response.


svn commit: r425552 - /struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/AbstractCreateAction.java

2006-07-25 Thread hrabago
Author: hrabago
Date: Tue Jul 25 16:14:19 2006
New Revision: 425552

URL: http://svn.apache.org/viewvc?rev=425552&view=rev
Log:
Let the user know if an action mapping isn't going anywhere.

Modified:

struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/AbstractCreateAction.java

Modified: 
struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/AbstractCreateAction.java
URL: 
http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/AbstractCreateAction.java?rev=425552&r1=425551&r2=425552&view=diff
==
--- 
struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/AbstractCreateAction.java
 (original)
+++ 
struts/struts1/trunk/core/src/main/java/org/apache/struts/chain/commands/AbstractCreateAction.java
 Tue Jul 25 16:14:19 2006
@@ -73,7 +73,12 @@
 String type = actionConfig.getType();
 
 if (type == null) {
-LOG.trace("no type for " + actionConfig.getPath());
+if ((actionConfig.getForward() == null)
+&& (actionConfig.getInclude() == null)) {
+LOG.error("no type for " + actionConfig.getPath());
+} else {
+LOG.trace("no type for " + actionConfig.getPath());
+}
 
 return (false);
 }




svn commit: r425554 - /struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionRedirect.java

2006-07-25 Thread hrabago
Author: hrabago
Date: Tue Jul 25 16:15:36 2006
New Revision: 425554

URL: http://svn.apache.org/viewvc?rev=425554&view=rev
Log:
Copy the set of arbitrary properties when copying a ForwardConfig.

Modified:

struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionRedirect.java

Modified: 
struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionRedirect.java
URL: 
http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionRedirect.java?rev=425554&r1=425553&r2=425554&view=diff
==
--- 
struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionRedirect.java
 (original)
+++ 
struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionRedirect.java
 Tue Jul 25 16:15:36 2006
@@ -119,7 +119,7 @@
 
 /**
  * Construct a new instance with a [EMAIL PROTECTED] ForwardConfig} 
object to copy
- * name, path, and contextRelative values from.
+ * name, path, contextRelative, and arbitrary property values from.
  *
  * @param baseConfig the [EMAIL PROTECTED] ForwardConfig} to copy 
configuration
  *   values from
@@ -129,6 +129,7 @@
 setPath(baseConfig.getPath());
 setModule(baseConfig.getModule());
 setRedirect(baseConfig.getRedirect());
+inheritProperties(baseConfig);
 initializeParameters();
 }
 




svn commit: r425569 - /struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionRedirect.java

2006-07-25 Thread hrabago
Author: hrabago
Date: Tue Jul 25 17:35:35 2006
New Revision: 425569

URL: http://svn.apache.org/viewvc?rev=425569&view=rev
Log:
Test ActionRedirect's handling of a ForwardConfig's arbitrary properties.

Modified:

struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionRedirect.java

Modified: 
struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionRedirect.java
URL: 
http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionRedirect.java?rev=425569&r1=425568&r2=425569&view=diff
==
--- 
struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionRedirect.java
 (original)
+++ 
struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionRedirect.java
 Tue Jul 25 17:35:35 2006
@@ -106,6 +106,7 @@
 public void testActionRedirectFromExistingForward() {
 ActionForward forward = new ActionForward("/path.do?param=param1");
 forward.setRedirect(false);
+forward.setProperty("key","value");
 
 ActionRedirect ar = new ActionRedirect(forward);
 
@@ -117,6 +118,8 @@
 assertHasParameter(ar.parameterValues, "object1", "someString");
 assertEquals("Incorrect original path.", forward.getPath(),
 ar.getOriginalPath());
+assertEquals("Incorrect or missing property", "value",
+ar.getProperty("key"));
 assertTrue("Original had redirect to false", !ar.getRedirect());
 }
 




svn commit: r425573 - in /struts/struts1/trunk/core/src: main/java/org/apache/struts/action/ActionServlet.java test/java/org/apache/struts/action/TestActionServlet.java

2006-07-25 Thread hrabago
Author: hrabago
Date: Tue Jul 25 17:41:36 2006
New Revision: 425573

URL: http://svn.apache.org/viewvc?rev=425573&view=rev
Log:
STR-2917
Fix bug that prevents action-mapping-level forwards and exception handlers from 
inheriting onfig data from global forwards and exception handlers.

Modified:

struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java

struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionServlet.java

Modified: 
struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java
URL: 
http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java?rev=425573&r1=425572&r2=425573&view=diff
==
--- 
struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java
 (original)
+++ 
struts/struts1/trunk/core/src/main/java/org/apache/struts/action/ActionServlet.java
 Tue Jul 25 17:41:36 2006
@@ -1061,7 +1061,7 @@
 for (int i = 0; i < forwards.length; i++) {
 ForwardConfig forward = forwards[i];
 
-processForwardExtension(forward, config);
+processForwardExtension(forward, config, null);
 }
 
 for (int i = 0; i < forwards.length; i++) {
@@ -1076,14 +1076,18 @@
 }
 
 /**
- * Extend the forward's configuration as necessary.
+ * Extend the forward's configuration as necessary.  If actionConfig is 
+ * provided, then this method will process the forwardConfig as part
+ * of that actionConfig.  If actionConfig is null, the forwardConfig
+ * will be processed as a global forward.
  *
  * @param forwardConfig the configuration to process.
  * @param moduleConfig  the module configuration for this module.
+ * @param actionConfig  If applicable, the config for the current action.
  * @throws ServletException if initialization cannot be performed.
  */
 protected void processForwardExtension(ForwardConfig forwardConfig,
-ModuleConfig moduleConfig)
+ModuleConfig moduleConfig, ActionConfig actionConfig)
 throws ServletException {
 try {
 if (!forwardConfig.isExtensionProcessed()) {
@@ -1093,9 +1097,10 @@
 }
 
 forwardConfig =
-processForwardConfigClass(forwardConfig, moduleConfig);
+processForwardConfigClass(forwardConfig, moduleConfig,
+actionConfig);
 
-forwardConfig.processExtends(moduleConfig, null);
+forwardConfig.processExtends(moduleConfig, actionConfig);
 }
 } catch (ServletException e) {
 throw e;
@@ -1107,10 +1112,14 @@
 
 /**
  * Checks if the current forwardConfig is using the correct class based
- * on the class of its configuration ancestor.
+ * on the class of its configuration ancestor.  If actionConfig is 
+ * provided, then this method will process the forwardConfig as part
+ * of that actionConfig.  If actionConfig is null, the forwardConfig
+ * will be processed as a global forward.
  *
  * @param forwardConfig The forward to check.
  * @param moduleConfig  The config for the current module.
+ * @param actionConfig  If applicable, the config for the current action.
  * @return The forward config using the correct class as determined by the
  * config's ancestor and its own overridden value.
  * @throws UnavailableException if an instance of the forward config class
@@ -1118,7 +1127,8 @@
  * @throws ServletException on class creation error
  */
 protected ForwardConfig processForwardConfigClass(
-ForwardConfig forwardConfig, ModuleConfig moduleConfig)
+ForwardConfig forwardConfig, ModuleConfig moduleConfig,
+ActionConfig actionConfig)
 throws ServletException {
 String ancestor = forwardConfig.getExtends();
 
@@ -1128,7 +1138,17 @@
 }
 
 // Make sure that this config is of the right class
-ForwardConfig baseConfig = moduleConfig.findForwardConfig(ancestor);
+ForwardConfig baseConfig = null;
+if (actionConfig != null) {
+// Look for this in the actionConfig
+baseConfig = actionConfig.findForwardConfig(ancestor);
+} 
+
+if (baseConfig == null) {
+// Either this is a forwardConfig that inherits a global config,
+//  or actionConfig is null
+baseConfig = moduleConfig.findForwardConfig(ancestor);
+}
 
 if (baseConfig == null) {
 throw new UnavailableException("Unable to find " + "forward '"
@@ -1145,7 +1165,8 @@
 
 try {
 newForwardConfig =
-(ForwardConfig) 
RequestUtils.applicationInstance(baseConfigClassName);
+(Forwar

svn commit: r425585 - /struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionServlet.java

2006-07-25 Thread hrabago
Author: hrabago
Date: Tue Jul 25 18:44:13 2006
New Revision: 425585

URL: http://svn.apache.org/viewvc?rev=425585&view=rev
Log:
STR-2917
Additional tests for action-level config objects inheriting from global config 
objects.

Modified:

struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionServlet.java

Modified: 
struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionServlet.java
URL: 
http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionServlet.java?rev=425585&r1=425584&r2=425585&view=diff
==
--- 
struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionServlet.java
 (original)
+++ 
struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionServlet.java
 Tue Jul 25 18:44:13 2006
@@ -862,6 +862,48 @@
 }
 
 /**
+ * Test that an ActionConfig's ForwardConfig can inherit from a 
+ * global ForwardConfig.
+ */
+public void testProcessActionExtensionWithForwardConfig()
+throws ServletException {
+ForwardConfig forwardConfig = new ForwardConfig();
+forwardConfig.setName("sub");
+forwardConfig.setExtends("success");
+baseAction.addForwardConfig(forwardConfig);
+
+moduleConfig.addActionConfig(baseAction);
+moduleConfig.addForwardConfig(baseForward);
+actionServlet.processActionConfigExtension(baseAction, moduleConfig);
+
+forwardConfig = baseAction.findForwardConfig("sub");
+
+assertEquals("'sub' forward's inheritance was not processed.",
+baseForward.getPath(), forwardConfig.getPath());
+}
+
+/**
+ * Test that an ActionConfig's ExceptionConfig can inherit from a 
+ * global ExceptionConfig.
+ */
+public void testProcessActionExtensionWithExceptionConfig()
+throws ServletException {
+ExceptionConfig exceptionConfig = new ExceptionConfig();
+exceptionConfig.setType("SomeException");
+exceptionConfig.setExtends("java.lang.NullPointerException");
+baseAction.addExceptionConfig(exceptionConfig);
+
+moduleConfig.addActionConfig(baseAction);
+moduleConfig.addExceptionConfig(baseException);
+actionServlet.processActionConfigExtension(baseAction, moduleConfig);
+
+exceptionConfig = baseAction.findExceptionConfig("SomeException");
+
+assertEquals("SomeException's inheritance was not processed.",
+baseException.getKey(), exceptionConfig.getKey());
+}
+
+/**
  * Make sure processActionConfigClass() returns an instance of the correct
  * class if the base config is using a custom class.
  */




svn commit: r425586 - /struts/maven/tags/STRUTS_MASTER_3/

2006-07-25 Thread wsmoak
Author: wsmoak
Date: Tue Jul 25 19:35:57 2006
New Revision: 425586

URL: http://svn.apache.org/viewvc?rev=425586&view=rev
Log:
Tagged struts-master pom v3 from r419162.

Added:
struts/maven/tags/STRUTS_MASTER_3/
  - copied from r419162, struts/maven/trunk/pom/



svn commit: r425589 - in /struts/struts2/trunk/apps/mailreader/src/main: resources/struts.properties resources/struts.xml webapp/pages/Logon.jsp webapp/pages/Registration.jsp webapp/pages/Subscription

2006-07-25 Thread husted
Author: husted
Date: Tue Jul 25 20:04:47 2006
New Revision: 425589

URL: http://svn.apache.org/viewvc?rev=425589&view=rev
Log:
WW-1353 Update MailReader to use wildcards instead of bangs.

Modified:
struts/struts2/trunk/apps/mailreader/src/main/resources/struts.properties
struts/struts2/trunk/apps/mailreader/src/main/resources/struts.xml
struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Logon.jsp
struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Registration.jsp
struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Subscription.jsp

Modified: 
struts/struts2/trunk/apps/mailreader/src/main/resources/struts.properties
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/resources/struts.properties?rev=425589&r1=425588&r2=425589&view=diff
==
--- struts/struts2/trunk/apps/mailreader/src/main/resources/struts.properties 
(original)
+++ struts/struts2/trunk/apps/mailreader/src/main/resources/struts.properties 
Tue Jul 25 20:04:47 2006
@@ -2,5 +2,4 @@
 struts.devMode = true
 struts.action.extension = do
 struts.custom.i18n.resources = resources
-struts.compatibilityMode = true
 

Modified: struts/struts2/trunk/apps/mailreader/src/main/resources/struts.xml
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/resources/struts.xml?rev=425589&r1=425588&r2=425589&view=diff
==
--- struts/struts2/trunk/apps/mailreader/src/main/resources/struts.xml 
(original)
+++ struts/struts2/trunk/apps/mailreader/src/main/resources/struts.xml Tue Jul 
25 20:04:47 2006
@@ -55,7 +55,7 @@
 
 
 
-
+
 /pages/Logon.jsp
 Welcome
 MainMenu
@@ -74,24 +74,24 @@
 /pages/MainMenu.jsp
 
 
-
+
 /pages/Registration.jsp
 MainMenu
 
 
 
-
+
 /pages/Registration.jsp
 MainMenu
 
 
 
-
+
 /pages/Subscription.jsp
 Registration!input
 
 
-
+
 /pages/Subscription.jsp
 Registration!input
 

Modified: struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Logon.jsp
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Logon.jsp?rev=425589&r1=425588&r2=425589&view=diff
==
--- struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Logon.jsp 
(original)
+++ struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Logon.jsp Tue 
Jul 25 20:04:47 2006
@@ -12,7 +12,7 @@
 
 
 
-
+
 
 
 

Modified: 
struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Registration.jsp
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Registration.jsp?rev=425589&r1=425588&r2=425589&view=diff
==
--- struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Registration.jsp 
(original)
+++ struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Registration.jsp 
Tue Jul 25 20:04:47 2006
@@ -17,7 +17,7 @@
 
 
 
-
+
 
 
 

Modified: 
struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Subscription.jsp
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Subscription.jsp?rev=425589&r1=425588&r2=425589&view=diff
==
--- struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Subscription.jsp 
(original)
+++ struts/struts2/trunk/apps/mailreader/src/main/webapp/pages/Subscription.jsp 
Tue Jul 25 20:04:47 2006
@@ -20,7 +20,7 @@
 
 
 
-
+
 
 
 




svn commit: r425615 [2/2] - in /struts/struts2/trunk: core/src/main/java/org/apache/struts2/ core/src/main/java/org/apache/struts2/components/ core/src/main/java/org/apache/struts2/components/template

2006-07-25 Thread mrdon
Modified: 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java?rev=425615&r1=425614&r2=425615&view=diff
==
--- 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java
 (original)
+++ 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java
 Tue Jul 25 21:33:53 2006
@@ -19,7 +19,7 @@
 
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.StrutsTestCase;
-import org.apache.struts2.config.Configuration;
+import org.apache.struts2.config.Settings;
 import org.apache.struts2.views.jsp.StrutsMockServletContext;
 
 /**
@@ -29,7 +29,7 @@
 public class FreemarkerManagerTest extends StrutsTestCase {

public void testIfStrutsEncodingIsSetProperty() throws Exception {
-   Configuration.set(StrutsConstants.STRUTS_I18N_ENCODING, 
"UTF-8");
+   Settings.set(StrutsConstants.STRUTS_I18N_ENCODING, "UTF-8");
StrutsMockServletContext servletContext = new 
StrutsMockServletContext();

servletContext.setAttribute(FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY, null);
freemarker.template.Configuration conf = 
FreemarkerManager.getInstance().getConfiguration(servletContext);

Modified: 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java?rev=425615&r1=425614&r2=425615&view=diff
==
--- 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java
 (original)
+++ 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/AbstractTagTest.java
 Tue Jul 25 21:33:53 2006
@@ -20,7 +20,7 @@
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.TestAction;
 import org.apache.struts2.StrutsTestCase;
-import org.apache.struts2.config.Configuration;
+import org.apache.struts2.config.Settings;
 import org.apache.struts2.dispatcher.ApplicationMap;
 import org.apache.struts2.dispatcher.Dispatcher;
 import org.apache.struts2.dispatcher.RequestMap;
@@ -118,7 +118,7 @@
 
 ActionContext.setContext(new ActionContext(context));
 
-Configuration.setConfiguration(null);
+Settings.setInstance(null);
 }
 
 protected void tearDown() throws Exception {

Modified: 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/PortletUrlTagTest.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/PortletUrlTagTest.java?rev=425615&r1=425614&r2=425615&view=diff
==
--- 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/PortletUrlTagTest.java
 (original)
+++ 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/PortletUrlTagTest.java
 Tue Jul 25 21:33:53 2006
@@ -49,7 +49,7 @@
 import org.apache.struts2.dispatcher.Dispatcher;
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.util.OgnlValueStack;
-import org.apache.struts2.config.Configuration;
+import org.apache.struts2.config.Settings;
 
 /**
  */
@@ -80,7 +80,7 @@
public void setUp() throws Exception {
super.setUp();

-   Configuration.reset();
+   Settings.reset();
 Dispatcher.setInstance(new Dispatcher(null));
 
 mockPortletApiAvailable();

Modified: 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java?rev=425615&r1=425614&r2=425615&view=diff
==
--- 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java
 (original)
+++ 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/PropertyTagTest.java
 Tue Jul 25 21:33:53 2006
@@ -22,7 +22,7 @@
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.StrutsTestCase;
 import org.apache.struts2.StrutsConstants;
-import org.apache.struts2.config.Configuration;
+import org.apache.struts2.config.Settings;
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.util.OgnlValueStack;
 
@@ -160,8 +160,8 @@
 
 public void testWithAltSyntax1() throws Exception {
 // setups
-Configuration.set(StrutsConstants.STRUTS_TAG_ALTSYNTAX, "true");
-assertEquals(Confi

svn commit: r425635 - in /struts/struts2/trunk: apps/build.xml build.xml lib/

2006-07-25 Thread mrdon
Author: mrdon
Date: Tue Jul 25 22:46:24 2006
New Revision: 425635

URL: http://svn.apache.org/viewvc?rev=425635&view=rev
Log:
Removing the old Ant build
WW-1384

Removed:
struts/struts2/trunk/apps/build.xml
struts/struts2/trunk/build.xml
struts/struts2/trunk/lib/