1 2 Previous Next 23 Replies Latest reply on Jan 17, 2008 11:30 AM by fmarwede

    "Not well formed" issue when speicfying a drag indicator

    vitanov

      Hello guys,
      So this is my issue:
      I'm developing a masters diploma project that has to be ready by 23.01. Now because I am developing this since the summer, I started with richfaces 3.0.1. My current configuration is:
      JSF Sun RI 1.2
      Tomahawk 1.1.6
      Facelets 1.1.14
      Tomcat 5.5.23
      All running on Java 5 update 12
      So, I decided to migrate to richfaces 3.1.3 because of the contextMenu support and I also need the "nothingLabel" option added to the rich:suggestionbox.
      After I migrated (changed the web.xml, removed the a4j jars and filter, added the richfaces filter) now I have a unsolveable issue - if I have a rich:dragIndicator on a page, the page is not rendered and FF says - "XML Parsing Error: not well-formed". The thing it does't like is:

      elt.indicatorTemplates = {};elt.markers['accept'] = "<img alt=\"\" border=\"0\" width=\"16\" height=\"16\" src=\"/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/images/accept.gif.jsf\" />"

      I opened the image mentioned in the link - it's the image for acceptance of dragged objects. So then I opened the page containing the richfaces examples and viewed the source. There IS a difference. That is my not-well formed page source:

      <div class="drgind_fly drgind_default drag_indicator " id="indicator" style="display: none; " xmlns:rich="http://richfaces.ajax4jsf.org/rich">
      <script type="text/javascript">var elt = $("indicator");
       elt.markers = {};
       elt.indicatorTemplates = {};elt.markers['accept'] = "<img alt=\"\" border=\"0\" width=\"16\" height=\"16\" src=\"/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/images/accept.gif.jsf\" />";
      elt.markers['default'] = "<img alt=\"\" border=\"0\" width=\"16\" height=\"16\" src=\"/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/images/default.gif.jsf\" />";
      elt.markers['reject'] = "<img alt=\"\" border=\"0\" width=\"16\" height=\"16\" src=\"/a4j_3_2_0-SNAPSHOTorg/richfaces/renderkit/html/images/reject.gif.jsf\" />";
      elt.indicatorTemplates['single'] = DefaultDragIndicatorView;elt.indicatorTemplates['multi'] = DefaultDragIndicatorView;createDragIndicator(elt, '', '');</script></div>
      

      And this is the source on the richfaces demo page:

      <div class="drgind_fly drgind_default drag_indicator " id="indicator" style="display: none; " xmlns:rich="http://richfaces.ajax4jsf.org/rich"><script type="text/javascript">
      //<![CDATA[
      var elt = $("indicator");
       elt.markers = {};
       elt.indicatorTemplates = {};elt.markers['accept'] = "<img alt=\"\" border=\"0\" width=\"16\" height=\"16\" src=\"/richfaces-demo/a4j_3_1_3.GAorg/richfaces/renderkit/html/images/accept.gif.jsf\" />";
      elt.markers['default'] = "<img alt=\"\" border=\"0\" width=\"16\" height=\"16\" src=\"/richfaces-demo/a4j_3_1_3.GAorg/richfaces/renderkit/html/images/default.gif.jsf\" />";
      elt.markers['reject'] = "<img alt=\"\" border=\"0\" width=\"16\" height=\"16\" src=\"/richfaces-demo/a4j_3_1_3.GAorg/richfaces/renderkit/html/images/reject.gif.jsf\" />";
      elt.indicatorTemplates['single'] = DefaultDragIndicatorView;elt.indicatorTemplates['multi'] = DefaultDragIndicatorView;createDragIndicator(elt, '', '');
      //]]>
      </script></div>


      The <![CDATA[ ... ]] element is different. It is not rendered in my page. I tried using 3.2.0 snapshot, but the same happens. But there is a difference also between 3.1.3 and 3.2.0. That is - when I have no declaration of rich:dragIndicator in my page, there is nothing rendered while dragging an object with 3.1.3, but there is a dashed border in 3.2.0, that turns red and green - depending on the dropSupport accepted types. But that is not enough for me, I want to make it perfect... So I guess I will need your help - why is this CDATA element not rendered under my conditions? I will appreciate your help, because I have a close deadline guys, thanks in advance!

        • 1. Re:
          vitanov

          This is what is rendered using the richfaces 3.0.1:

          <div class="drgind_fly drgind_default drag_indicator " id="dragIndicator" style="display: none; " xmlns:rich="http://richfaces.ajax4jsf.org/rich"><script type="text/javascript">/*<![CDATA[*/
           var elt = $("dragIndicator");
           elt.markers = {};
           elt.indicatorTemplates = {};
           /*]]>*//*<![CDATA[*/elt.markers['accept'] = "<img alt=\"\" border=\"0\" width=\"16\" height=\"16\" src=\"/a4j.res/org/richfaces/renderkit/html/images/accept.gif.jsf\" />";
          elt.markers['default'] = "<img alt=\"\" border=\"0\" width=\"16\" height=\"16\" src=\"/a4j.res/org/richfaces/renderkit/html/images/default.gif.jsf\" />";
          elt.markers['reject'] = "<img alt=\"\" border=\"0\" width=\"16\" height=\"16\" src=\"/a4j.res/org/richfaces/renderkit/html/images/reject.gif.jsf\" />";
          elt.indicatorTemplates['single'] = function(element, jsParams) {
          var content = "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" class=\"drgind_internal\" style=\"height : 100%\"><tr><td class=\"drgind_marker\">" + ((!!jsParams['marker']) ? jsParams['marker'] : "") + "</td><td class=\"drgind_text\"><div class=\"drgind_wordcut drgind_text_content\">" + ((!!jsParams['label']) ? jsParams['label'] : "") + "</div></td></tr></table><div class=\"drgind_shadow\"></div>";
           new Insertion.Top(element, content);
          };elt.indicatorTemplates['multi'] = function(element, jsParams) {
          var content = "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" class=\"drgind_internal\" style=\"height : 100%\"><tr><td class=\"drgind_marker\">" + ((!!jsParams['marker']) ? jsParams['marker'] : "") + "</td><td class=\"drgind_text\"><div class=\"drgind_wordcut drgind_text_content\">" + ((!!jsParams['label']) ? jsParams['label'] : "") + "</div></td></tr></table><div class=\"drgind_shadow\"></div>";
           new Insertion.Top(element, content);
          };/*]]>*//*<![CDATA[*/
           createDragIndicator(elt, '', '');
           /*]]>*/</script></div>
          


          Why is the script not rendered in a CDATA block when I use richfaces 3.2.0? This is why the "not well formed" error is displayed. Is there anything I can do or just give up trying?

          • 2. Re:
            vitanov

            Well, after all the help I got I guess I will have to use Ice faces drag n drop.

            • 3. Re:
              sergeyhalipov

              It is strange... There is <![CDATA[] in my examples with facelets. I tested with richfaces 3.1.3 and 3.2.0 snapshot. There is <![CDATA[] in http://livedemo.exadel.com/richfaces-demo/richfaces/dragSupport.jsf
              also.
              Could you attach some simple WAR file which would help us to reproduce the bug?

              • 4. Re:
                vitanov

                Allright, I will try to simplify it because it is large now. I will just finish the work on some menus here and will post it later.

                • 5. Re:

                  Vitanov, perhaps you can provide a code snippet, where I can see the position of your dragIndicator in the overall context - simply speaking: delete all stuff except forms, regions and so on and the dragIndicator.

                  The reason why ask you for that: Sometime ago I had some strange problems with the dragIndicator which I solved by changing the position of the richIndicator definition. Perhaps it's bullshit to see a relation to your problem but let's find it out.

                  • 6. Re:

                    Did some tests now.

                    I have a rich:tree with a drag:support on some nodes and I can reproduce your bug in the following way: Placing the dragIndicator into a rich:treeNode.

                    So please test to put the dragIndicator on different places on the page. In our project it is outside of everything just the first tag after body opening:

                    <body>
                    
                    <rich:dragIndicator id="indicator"/>
                    
                    ...
                    
                    </body>
                    


                    • 7. Re:
                      vitanov

                      Hi,
                      I have stripped down the web pages and left one that is working. There are no welcome filelists, just type /users/index.jsf after the context root - this is the page that is not working. To see the bug remove the "<ui:remove>" tags around <rich:dragIndicator id="indicator"></rich:dragIndicator>. I did not have enough time to strip down the whole application, so i left over a lot of the java classes, excuse me for that.
                      http://www.flyupload.com/?fid=2602825

                      • 8. Re:
                        vitanov

                        fmarwede,
                        I played around with the position of the dragIndicator tag in the page, no success though - I even placed it in the template, just after . But it renders the same thing every time.

                        • 9. Re:

                          Okay...anyway for Sergey in short:

                          -> Bug reproduced with dragIndicator in rich:treeNode (everywhere else it worked)
                          -> Environment: FF 2.0, Tomcat 5.5, RF 3.2.0 snapshot from friday, Facelets, jsf 1.2, no other component library.

                          Perhaps it helps to find out what causes the problem...

                          • 10. Re:

                            Vitanov, I get an exception when trying to deploy your war file:

                            java.util.MissingResourceException: Can't find bundle for base name com.ru.mvitanov.tsc.web.message.Messages


                            Maybe you forgot something...

                            • 11. Re:
                              vitanov

                              There is a resource bundle for english, so I think that maybe it is trying to locate a bundle for german, depending on your browser's settings? But on the other hand that is not very likely, because the locale is specified in the template like this:

                              <f:view locale="#{mainBean.locale}">
                              

                              And the property in the backing bean is "en". There is a file "TSC.war\WEB-INF\classes\com\ru\mvitanov\tsc\web\message\Messages_en.properties", so maybe copy this one under the name "Messages_de.properties" and just "Messages.properties" in the same folder would do the job. It's a strange thing though, it should be working. I tested it on tomcat 5.5.23 before sending the war. Tell me if you had luck deploying it.

                              • 12. Re:
                                vitanov

                                Any suggestions? Because there is no rich:jquery in 3.0.1 :(

                                • 13. Re:

                                  Sorry for late answer. Will analyze this tomorrow, okay?

                                  Greetings!

                                  • 14. Re:
                                    vitanov

                                    Thanks man, I really appreciate this. I try to "hack" it, make it work somehow, but no luck until now.

                                    1 2 Previous Next