You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2014/03/11 18:42:42 UTC

svn commit: r1576435 - in /myfaces/core/trunk/impl/src: main/java/org/apache/myfaces/view/facelets/component/ main/java/org/apache/myfaces/view/facelets/tag/jsf/ main/java/org/apache/myfaces/view/facelets/tag/jsf/html/ test/java/org/apache/myfaces/view...

Author: lu4242
Date: Tue Mar 11 17:42:41 2014
New Revision: 1576435

URL: http://svn.apache.org/r1576435
Log:
MYFACES-3866 Unexpected result when using "http://xmlns.jcp.org/jsf" namespace

Added:
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/testNoMatchJSFElement1.xhtml
      - copied, changed from r1576088, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/testHtmlPassthrough1.xhtml
Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/_JsfElement.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/JsfLibrary.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/DefaultTagDecorator.java
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DefaultHtmlDecoratorTestCase.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/_JsfElement.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/_JsfElement.java?rev=1576435&r1=1576434&r2=1576435&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/_JsfElement.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/component/_JsfElement.java Tue Mar 11 17:42:41 2014
@@ -33,7 +33,7 @@ abstract class _JsfElement extends UIPan
     _EventProperties, _FocusBlurProperties, _ChangeSelectProperties
 {
     public static final String COMPONENT_FAMILY = "javax.faces.Panel";
-    public static final String COMPONENT_TYPE = "oam.passthrough.Element";
+    public static final String COMPONENT_TYPE = "javax.faces.Panel";
     
     /**
      * HTML: Script to be invoked when the page is loaded

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/JsfLibrary.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/JsfLibrary.java?rev=1576435&r1=1576434&r2=1576435&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/JsfLibrary.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/JsfLibrary.java Tue Mar 11 17:42:41 2014
@@ -34,5 +34,8 @@ public final class JsfLibrary extends Ab
     public JsfLibrary()
     {
         super(NAMESPACE, ALIAS_NAMESPACE);
+        
+        this.addComponent("element", "javax.faces.Panel", 
+            "javax.faces.passthrough.Element", JsfElementHandler.class);
     }
 }

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/DefaultTagDecorator.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/DefaultTagDecorator.java?rev=1576435&r1=1576434&r2=1576435&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/DefaultTagDecorator.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/DefaultTagDecorator.java Tue Mar 11 17:42:41 2014
@@ -157,7 +157,7 @@ public class DefaultTagDecorator impleme
       LOCAL_NAME_ARR['T'] = T_NAMES;
     }
     
-    private static final TagDecoratorExecutor NO_MATCH_SELECTOR = new TagSelectorImpl("jsf:element", JSF_NAMESPACE);
+    private static final TagDecoratorExecutor NO_MATCH_SELECTOR = new TagSelectorImpl(null, "jsf:element");
     
     public Tag decorate(Tag tag)
     {
@@ -403,6 +403,7 @@ public class DefaultTagDecorator impleme
                     }
                     else if (j == 3 && targetQName.startsWith("jsf"))
                     {
+                        this.targetNamespace = JsfLibrary.ALIAS_NAMESPACE;
                         this.targetLocalName = targetQName.substring(j+1);
                     }
                 }

Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DefaultHtmlDecoratorTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DefaultHtmlDecoratorTestCase.java?rev=1576435&r1=1576434&r2=1576435&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DefaultHtmlDecoratorTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DefaultHtmlDecoratorTestCase.java Tue Mar 11 17:42:41 2014
@@ -300,4 +300,21 @@ public class DefaultHtmlDecoratorTestCas
         Assert.assertNotNull(decoratedTag);
     }
     
+    @Test
+    public void testNoMatchJSFElement1() throws Exception
+    {
+        request.getSession().setAttribute("test", new MockBean());
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "testNoMatchJSFElement1.xhtml");
+
+        UIComponent box1 = root.findComponent("myForm:box1");
+        Assert.assertNotNull(box1);
+        Assert.assertEquals(box1.getRendererType(), "javax.faces.passthrough.Element");
+        
+        //StringWriter sw = new StringWriter();
+        //MockResponseWriter mrw = new MockResponseWriter(sw);
+        //facesContext.setResponseWriter(mrw);
+        //sw.flush();
+    }    
 }

Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/testNoMatchJSFElement1.xhtml (from r1576088, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/testHtmlPassthrough1.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/testNoMatchJSFElement1.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/testNoMatchJSFElement1.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/testHtmlPassthrough1.xhtml&r1=1576088&r2=1576435&rev=1576435&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/testHtmlPassthrough1.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/testNoMatchJSFElement1.xhtml Tue Mar 11 17:42:41 2014
@@ -18,57 +18,11 @@
 	xmlns:h="http://java.sun.com/jsf/html"
 	xmlns:f="http://java.sun.com/jsf/core"
     xmlns:jsf="http://java.sun.com/jsf">
-<head jsf:id="idHead">
-    <link rel="stylesheet" type="text/css" href="custom.css"/>
-    <script type="text/javascript">
-        function hello(){
-            alert("Hello");
-        }
-    </script>
-    <link jsf:id="osh" rel="stylesheet" type="text/css" jsf:library="mylib" jsf:name="resource.css"/>
-    <script jsf:id="osc" type="text/javascript">
-        function hello(){
-            alert("Hello");
-        }
-    </script>
+<head>
 </head>
-<body jsf:id="idBody">
+<body>
     <form jsf:id="myForm">
-        <a jsf:id="link1" jsf:action="#{test.testAction}"/>
-        <a jsf:id="link2" jsf:actionListener="#{test.testActionListener}"/>
-        <a jsf:id="link3" jsf:value="/my/new/location.txt"/>
-        <a jsf:id="link4" jsf:outcome="rollback"/>
-        <button jsf:id="button1" jsf:action="#{test.testAction}"/>
-        <button jsf:id="button2" jsf:outcome="rollback"/>
-        <img jsf:id="img1" jsf:url="/my/image.png"/>
-        <input jsf:id="input1" type="button"/>
-        <input jsf:id="input2" type="checkbox"/>
-        <input jsf:id="input3" type="color"/>
-        <input jsf:id="input4" type="date"/>
-        <input jsf:id="input5" type="datetime"/>
-        <input jsf:id="input6" type="datetime-local"/>
-        <input jsf:id="input7" type="email"/>
-        <input jsf:id="input8" type="month"/>
-        <input jsf:id="input9" type="number"/>
-        <input jsf:id="input10" type="range"/>
-        <input jsf:id="input11" type="search"/>
-        <input jsf:id="input12" type="time"/>
-        <input jsf:id="input13" type="url"/>
-        <input jsf:id="input14" type="week"/>
-        <input jsf:id="input15" type="file"/>
-        <input jsf:id="input16" type="hidden"/>
-        <input jsf:id="input17" type="password"/>
-        <input jsf:id="input18" type="reset"/>
-        <input jsf:id="input19" type="submit"/>
-        <input jsf:id="input20" type="anything"/>
-        <label jsf:id="label1" />
-        <select jsf:id="select1">
-            <f:selectItem itemValue="option1"/>
-        </select>
-        <select jsf:id="select2" multiple="multiple">
-            <f:selectItem itemValue="option1"/>
-            <f:selectItem itemValue="option2"/>
-        </select>
+        <div jsf:id="box1">Hello World!</div>
     </form>
 </body>
 </html>
\ No newline at end of file