jsf - PostConstruct methos called again with richfaces 4.2 , works fine with myfaces -
I see in a page with various forms and many variations.
Here is my backing bean:
Import javax.annotation.PostConstruct; Import javax.faces.bean.ManagedBean; Import javax.faces.bean.ViewScoped; @ManJaddbeen @Vivascope Public Class Multiform Bean {String Input Text 1 = ""; String input text 2 = ""; @PostConstruct Public Zero initializeBean () {System.out.println ("PostConstruct call ------------------"); } Public string getInputText1 () {inputText1; } Public Zero Set InputText1 (string inputtext1) {this.inputText1 = inputText1; } Public string getInputText2 () {returnText2; } Public Zero Set InputText2 (string inputtext2) {this.inputText2 = inputText2; } Public Zero doSubmit1 () {inputText2 = inputText1; } Public Zero doSubmit2 () {inputText1 = inputText2; }}
When I use the following XHTML, click Submit and Submit 2, at any time, you will not call the Post Editor at any time:
& lt; A: Body & gt; & Lt; H: form id = "first form" prependId = "false" & gt; & Lt; H: Panel Group Layout = "Block" id = "renderTarget1" /> & Lt; H: InputTapted ID = "First_input" value = "# {Multiformbeen.InputText1}" /> & Lt; H: command button id = "click1" action = "# {multiformbeon.do SBimit1}" value = "plus1" type = "submit" onclick = "javascript: jsf.ajax.request (this, event, {execute : 'Firstform', render: 'rendererage 1 second form'}); returned; "& gt; & Lt; / H: CommandButton & gt; & Lt; / H: form & gt; & Lt; H: form id = "secondForm" prependId = "false" & gt; & Lt; H: Panel Group Layout = "Block" id = "renderTarget2" /> & Lt; H: Input Text id = "second_input" value = "# {multiFormBean.inputText2}" /> & Lt; H: command button id = "click2" action = "# {multiformbeam.dosmit2}" value = "plus2" type = "submit" onclick = "javascript: jsf.ajax.request (this, event, {execute: 'Secondform', render: 'rendertrateg 2 first form'}); returned; "& gt; & Lt; / H: CommandButton & gt; & Lt; / H: form & gt; & Lt; / H: Body & gt;
But post the following XHTTL more than once:
& lt; H: body & gt; & Lt; H: form id = "first form" prependId = "false" & gt; & Lt; H: Panel Group Layout = "Block" id = "renderTarget1" /> & Lt; H: InputTapted ID = "First_input" value = "# {Multiformbeen.InputText1}" /> & Lt; A4j: commandButton id = "click1" action = "# {multiFormBean.doSubmit1}" value = "plus1" type = "submit" execution = "@form" render = "rendertrage 1, secondform" /> & Lt; / H: form & gt; & Lt; H: form id = "secondForm" prependId = "false" & gt; & Lt; H: Panel Group Layout = "Block" id = "renderTarget2" /> & Lt; H: Input Text id = "second_input" value = "# {multiFormBean.inputText2}" /> & Lt; A4j: commandButton id = "click2" action = "# {multiFormBean.doSubmit2}" value = "plus 2" type = "submit" execution = "render @form" = "rendertrabet2, first form" /> & Lt; / H: form & gt; & Lt; / H: Body & gt;
Please give me In addition to this, I see that I have a4j command button with & lt; A4j: commandButton & gt; Instead of
& lt; H: commandButton & gt;
doSubmit2 ()
I think that the problem here is inside the bug inside JSF2 and Richfaces4 has started using JSF embedded Ajax capabilities with the Referees 4 version . And there is a bug with using multiple forms on the page containing AJAX requests. There is a problem that Richface offers special hidden input with the current pseudo-visual phase ID. This ID changes when the new view is presented. And it has also been presented with every request to show that it is related to some specific view. Therefore, when you have several forms on the same page after the first page on an AJAX request, the visual position is taking the wrong place and it can not be submitted again for another time. Occasionally the behavior looks very strange with no logical explanation.
The post contract is called twice because the server thinks that two requests are related to different views (see state is not dreaded) and as far as bean, click on Ajax created twice After doing this, it can stop working completely because the server does not recognize the watch as identification (maybe what you see when you can not click on the second submit button).
In the first place, you can fix this bug (and much more) than the latest version of the JSF and Richfase available to you first.
Comments
Post a Comment