Author: niallp
Date: Mon Nov 21 15:44:05 2005
New Revision: 348028

URL: http://svn.apache.org/viewcvs?rev=348028&view=rev
Log:
Fix for Bug 37585 - html:link broken in the struts-examples webapp, reported by 
Wendy Smoak

Modified:
    struts/apps/trunk/examples/src/webapp/exercise/html-link.jsp
    
struts/core/trunk/src/java/org/apache/struts/config/impl/ModuleConfigImpl.java
    struts/core/trunk/src/java/org/apache/struts/util/ModuleUtils.java

Modified: struts/apps/trunk/examples/src/webapp/exercise/html-link.jsp
URL: 
http://svn.apache.org/viewcvs/struts/apps/trunk/examples/src/webapp/exercise/html-link.jsp?rev=348028&r1=348027&r2=348028&view=diff
==============================================================================
--- struts/apps/trunk/examples/src/webapp/exercise/html-link.jsp (original)
+++ struts/apps/trunk/examples/src/webapp/exercise/html-link.jsp Mon Nov 21 
15:44:05 2005
@@ -186,10 +186,6 @@
         <html:link action="/welcome" module="">application welcome page 
(module="")</html:link>
       </li>
       <li>
-        <html:link action="/welcome" module="/">application welcome 
page</html:link>
-        <!-- Test with empty string for module: <html:link action="/welcome" 
module="">application welcome page</html:link> -->
-      </li>
-      <li>
         <html:link action="/welcome" module="/exercise">Exercise module 
welcome page</html:link>
       </li>
       <li>
@@ -203,8 +199,10 @@
     <p>Pages</p>
     <ul>
       <li>
-        <html:link page="/welcome.do" module="">application welcome 
page</html:link>
-        <%-- FIXME: "/" slash throws NPE: <html:link page="/welcome.do" 
module="/">application welcome page</html:link> --%>
+        <html:link page="/welcome.do" module="">application welcome page 
(module="")</html:link>
+      </li>
+      <li>
+        <html:link page="/welcome.do" module="/">application welcome page 
(module="/")</html:link>
       </li>
       <li>
         <html:link page="/welcome.do" module="/exercise">Exercise module 
welcome page</html:link>

Modified: 
struts/core/trunk/src/java/org/apache/struts/config/impl/ModuleConfigImpl.java
URL: 
http://svn.apache.org/viewcvs/struts/core/trunk/src/java/org/apache/struts/config/impl/ModuleConfigImpl.java?rev=348028&r1=348027&r2=348028&view=diff
==============================================================================
--- 
struts/core/trunk/src/java/org/apache/struts/config/impl/ModuleConfigImpl.java 
(original)
+++ 
struts/core/trunk/src/java/org/apache/struts/config/impl/ModuleConfigImpl.java 
Mon Nov 21 15:44:05 2005
@@ -1,7 +1,7 @@
 /*
  * $Id$
  *
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@
      * @since Struts 1.2.8
      */
     public ModuleConfigImpl() {
-        this("/");
+        this("");
     }
 
     /**

Modified: struts/core/trunk/src/java/org/apache/struts/util/ModuleUtils.java
URL: 
http://svn.apache.org/viewcvs/struts/core/trunk/src/java/org/apache/struts/util/ModuleUtils.java?rev=348028&r1=348027&r2=348028&view=diff
==============================================================================
--- struts/core/trunk/src/java/org/apache/struts/util/ModuleUtils.java 
(original)
+++ struts/core/trunk/src/java/org/apache/struts/util/ModuleUtils.java Mon Nov 
21 15:44:05 2005
@@ -1,7 +1,7 @@
 /*
  * $Id$
  *
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -86,7 +86,11 @@
      * the context.
      */
     public ModuleConfig getModuleConfig(String prefix, ServletContext context) 
{
-        return (ModuleConfig) context.getAttribute(Globals.MODULE_KEY + 
prefix);
+        if (prefix == null || "/".equals(prefix)) {
+            return (ModuleConfig)context.getAttribute(Globals.MODULE_KEY);
+        } else {
+            return (ModuleConfig)context.getAttribute(Globals.MODULE_KEY + 
prefix);
+        }
     }
 
     /**
@@ -103,7 +107,7 @@
         ModuleConfig moduleConfig = null;
 
 
-        if(prefix != null) {
+        if (prefix != null) {
             //lookup module stored with the given prefix.
             moduleConfig = this.getModuleConfig(prefix, context);
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to