Commits

Anonymous committed 5842aee

Comments (0)

Files changed (4)

src/java/com/opensymphony/webwork/views/jsp/ui/FormTag.java

                 String result = UrlHelper.buildUrl(action, request, response, null);
                 addParameter("action", result);
 
-                // cut out anything between / and . should be the id and name
+                // namespace: cut out anything between the start and the last /
                 int slash = result.lastIndexOf('/');
-                int dot = result.indexOf('.', slash);
-                if (dot != -1) {
-                    id = result.substring(slash + 1, dot);
+                if (slash != -1) {
+                    addParameter("namespace", result.substring(0, slash));
                 } else {
-                    id = result.substring(slash + 1);
+                    addParameter("namespace", "");
+                }
+
+                // name/id: cut out anything between / and . should be the id and name
+                if (id == null) {
+                    slash = result.lastIndexOf('/');
+                    int dot = result.indexOf('.', slash);
+                    if (dot != -1) {
+                        id = result.substring(slash + 1, dot);
+                    } else {
+                        id = result.substring(slash + 1);
+                    }
+                    addParameter("id", id);
                 }
-                addParameter("id", id);
             }
 
             // only create the javaScriptValidationHolder if the actionName,and class is known

src/test/com/opensymphony/webwork/views/jsp/ui/FormTagTest.java

      */
     public void testFormTagWithDifferentActionExtension() throws Exception {
         request.setupGetServletPath("/testNamespace/testNamespaceAction");
+        String oldConfiguration = (String) Configuration.get("webwork.action.extension");
         Configuration.set("webwork.action.extension", "jspa");
 
         FormTag tag = new FormTag();
         tag.doStartTag();
         tag.doEndTag();
 
+        Configuration.set("webwork.action.extension", oldConfiguration);
+
         verify(FormTag.class.getResource("Formtag-5.txt"));
 
         // set it back to the default

src/test/com/opensymphony/webwork/views/jsp/ui/Formtag-1.txt

-<form id="myAction" name="myForm" action="myAction" method="POST" enctype="myEncType" >
+<form namespace="" id="myAction" name="myForm" action="myAction" method="POST" enctype="myEncType" >
 <table class="wwFormTable">
 </table>
 </form>

src/test/com/opensymphony/webwork/views/jsp/ui/Formtag-5.txt

-<form id="testNamespaceAction" name="myForm" action="/testNamespace/testNamespaceAction.jspa" method="POST" >
+<form namespace="/testNamespace" id="testNamespaceAction" name="myForm" action="/testNamespace/testNamespaceAction.jspa" method="POST" >
 <table class="wwFormTable">
 </table>
 </form>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.