This discussion is archived
10 Replies Latest reply: Dec 6, 2012 6:37 AM by 960507 RSS

composite components and order in the form

977886 Newbie
Currently Being Moderated
Hello,

We have a strange problem when mixing composite components with plain html/text in a form.
When we do a form submit f.ex. with a commandLink then the page comes back where all composite components are placed at the end of the form.

ex:
<h:form>
     <mna:mandatoryLabel forField="office" value="Office" />
     <h:outputLabel value="blabla" id="blabla"/>
     <h:commandLink id="test" actionlistener="test" value="test"/>
</h:form>

When you submit this form with the commandlink "test", then it comes back with the mandatoryLabel "Office" at the end of the form and no longer as the first field in the form.
Pressing F5 put everything back as normal.

Via ajax everything works fine and the composite component stays at the first place

Can anyone help?
Perhaps it has something to d with the time of rendering the different elements when comming back to the client.

Thanks!

Edited by: user7182559 on 4-dec-2012 5:08
  • 1. Re: composite components and order in the form
    960507 Newbie
    Currently Being Moderated
    What happens if you replace the <mna:mandatoryLabel forField="office" value="Office" /> with a <h:outputText> ?
  • 2. Re: composite components and order in the form
    977886 Newbie
    Currently Being Moderated
    Then everythings stays at the original place.
    So no problems then
  • 3. Re: composite components and order in the form
    960507 Newbie
    Currently Being Moderated
    If that is the case there might be a minor issue with that custom implementation of a label. I would recommend looking at its implementation to see if something stands out.
  • 4. Re: composite components and order in the form
    977886 Newbie
    Currently Being Moderated
    We have the issue with ALL our components.
    They typicaly look like this (just a part as an example)

    <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html
         xmlns="http://www.w3.org/1999/xhtml"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:c="http://java.sun.com/jsp/jstl/core"
         xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:composite="http://java.sun.com/jsf/composite"
         xmlns:p="http://primefaces.org/ui"
         xmlns:sec="http://www.springframework.org/security/tags"
         xmlns:fn="http://java.sun.com/jsp/jstl/functions">



    <composite:interface>
         <composite:attribute name="button" required="true" type="..." />
    </composite:interface>

    <composite:implementation>
    <ui:param name="button" value="#{cc.attrs.button}" />

         ...

    </composite:implementation>
    </html>
  • 5. Re: composite components and order in the form
    960507 Newbie
    Currently Being Moderated
    Which version of JSF are you using?
  • 6. Re: composite components and order in the form
    977886 Newbie
    Currently Being Moderated
    We are currently working with version 2.1.7, but did some tests with 2.1.14 as well and we have the same result
  • 7. Re: composite components and order in the form
    r035198x Pro
    Currently Being Moderated
    Try removing the doctype so that only one is left on a page even if it has many composites imported.
  • 8. Re: composite components and order in the form
    977886 Newbie
    Currently Being Moderated
    Thanks for the reply, but it doesn't help.
    I have now this most simple testscenario

    My xhtml:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:c="http://java.sun.com/jsp/jstl/core"
         xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:p="http://primefaces.org/ui"
         xmlns:test="http://java.sun.com/jsf/composite/components/test">
    <h:form>
              *<test:test/>*
              
              <h:outputLabel value="label" id="label"/>
              
              <h:commandLink id="test" actionlistener="theaction" value="test"/>
    </h:form>                                   
    </ui:composition>

    My component:
    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:composite="http://java.sun.com/jsf/composite">

         <composite:interface>
         </composite:interface>
         
         <composite:implementation>
              testcomponent
         </composite:implementation>
    </html>
  • 9. Re: composite components and order in the form
    977886 Newbie
    Currently Being Moderated
    We discovered that it may have something to do with spring webflow.
    Perhaps this might help with finding a sollution
  • 10. Re: composite components and order in the form
    960507 Newbie
    Currently Being Moderated
    You said it might be related to Spring WebFlow. Can you try it using plain vanilla JSF?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points