Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validateBean with copy in a composite component gets null values #241

Closed
fwelland opened this issue Apr 20, 2016 · 3 comments
Closed

validateBean with copy in a composite component gets null values #241

fwelland opened this issue Apr 20, 2016 · 3 comments

Comments

@fwelland
Copy link

Sorry if I am dredging up dead wood. closed/invalid issue #155 seems to still be an issue for me. I added to that issue -- but not clear if a closed issue would get any attention; so I added this new issue.

So this still doesn't work for me. I think I follow your example exactly.
My Environment: WildFly 10. JDK 1.8_77 (linux fwiw); oh and: 'org.omnifaces:omnifaces:2.2' (tried 2.3 also -- didn't make a difference).

(full project here: https://github.com/fwelland/GettyUp)

The form:

        <h:form >
            <br/>
            <h:panelGroup layout="block" >
                Playing with o:validateBean...
            </h:panelGroup>
            <br/>
            <h:panelGrid frame="box" columns="2" id="ohMy" >

                <h:outputLabel value="First Name" for="fname"/>
                <h:inputText  id="fname" value="#{vladTheController.searchCritter.firstName}"/>

                <h:outputLabel value="Last Name" />
                <ez:labledInput value="#{vladTheController.searchCritter.lastName}" />                               

                <h:outputLabel value="ID" for="eyeD"/>
                <h:inputText  id="eyeD" value="#{vladTheController.searchCritter.id}"/>

                <h:outputLabel value="Tag Line" for="tline"/>
                <h:inputText  id="tline" value="#{vladTheController.searchCritter.tagLine}"/>

                <h:panelGroup />
                <h:commandButton value="submit" action="#{vladTheController.submit()}">

                </h:commandButton>

                <h:messages />
                <h:panelGroup />

            </h:panelGrid>
            <o:validateBean value="#{vladTheController.searchCritter}" validationGroups="fhw.SearchCritterVladGroup" method="validateCopy" />
        </h:form>

The Composite:

<ui:component xmlns="http://www.w3.org/1999/xhtml"
        xmlns:cc="http://xmlns.jcp.org/jsf/composite"
        xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
        xmlns:h="http://xmlns.jcp.org/jsf/html">

<cc:interface>
    <cc:attribute name="value" />
    <cc:editableValueHolder name="input" targets="input" />
</cc:interface>
<cc:implementation>
    <h:inputText id="input" value="#{cc.attrs.value}" />
</cc:implementation>    

</ui:component> 

Some SOUT stuff:

16:42:56,471 INFO  [stdout] (default task-120) the copy is: SearchCritter(firstName=fred, lastName=null, id=123, tagLine=cheeze)
16:42:56,471 INFO  [stdout] (default task-120) the critter is: SearchCritter(firstName=fred, lastName=aaa, id=123, tagLine=cheeze)

The first output line comes from the validator that is working on the copy, or that is what I think is supposed to happen, correct?

The second output line comes from the controller's submit() method.

Notice lastName is not the same between the copy and 'the critter'. As you see, of the 4 attrs in the form, lastName is the only CC.

@BalusC
Copy link
Member

BalusC commented Apr 28, 2016

Coincidentally the previous issue #240 is exactly this issue. It's already fixed in today's latest 2.4-SNAPSHOT. Can you let me know if that also solves the problem for you?

@fwelland
Copy link
Author

fwelland commented Apr 28, 2016

Just tested. Seems to work as expected in my sample app (mentioned above). I pushed the changes up if you are interested -- but the only material change I made was the gradle deps to 2.4-SNAPSHOT. The rest of the changes I made were all println stuff to make my output more clear.

THANKS FOR YOUR HELP WITH THIS AND ALL YOU DO WITH OmniFaces (oh and bootsfaces too and on StackOverflow)!!

Oh and I look forward to when 2.4 goes 'gold'.

@BalusC
Copy link
Member

BalusC commented Apr 28, 2016

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants