I upgraded my test application with primefaces 2.2.M1, but the "ViewScopeds ManagedBeans" pass by the constructor to all requests (ajax or non-ajax). Someone is going through the same problem?
I use Mojarra 2.0.2
thx.
Primefaces 2.2.M1 and @ViewScoped
Danilo G. Magrini - Brazil
http://twitter.com/daniloMagrini
Mojarra 2.0.3 / Glassfish v3 / Primefaces 2.2RC1 / Netbeans 6.9
http://twitter.com/daniloMagrini
Mojarra 2.0.3 / Glassfish v3 / Primefaces 2.2RC1 / Netbeans 6.9
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
ViewScope example is working at showcase;
http://www.primefaces.org/showcase/ui/pprCounter.jsf
Maybe you can try with mojarra-2.0.3 as showcase does.
http://www.primefaces.org/showcase/ui/pprCounter.jsf
Maybe you can try with mojarra-2.0.3 as showcase does.
I'll leave the reasons that caused me to have two forms in my application to don't make the post too long. I will then use a merely illustrative example.
Page code:
ManagedBean code:
Using version 2.1 of Primefaces everything works correctly. When I use the version 2.2.M1 the constructor is executed whenever alternate between the buttons. There seems to be a problem for Mojarra... or is it?
Page code:
Code: Select all
<p:outputPanel id="otp"
layout="block">
<h:outputText value="Counter: #{mbTest.count}" />
<h:form>
<p:commandButton value="Increment"
actionListener="#{mbTest.increment}"
update="otp"/>
</h:form>
<h:form>
<p:commandButton value="Decrement"
actionListener="#{mbTest.decrement}"
update="otp"/>
</h:form>
</p:outputPanel>
Code: Select all
@ManagedBean(name = "mbTest")
@ViewScoped
public class MbTest implements Serializable {
private int count;
public MbTest() {
System.out.println("CONSTRUCTOR EXECUTED!"); // Log is better =)
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public void increment() {
count++;
}
public void decrement() {
count--;
}
}
Danilo G. Magrini - Brazil
http://twitter.com/daniloMagrini
Mojarra 2.0.3 / Glassfish v3 / Primefaces 2.2RC1 / Netbeans 6.9
http://twitter.com/daniloMagrini
Mojarra 2.0.3 / Glassfish v3 / Primefaces 2.2RC1 / Netbeans 6.9
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Instead of p:commandButton can you check with h:commandButton and f:ajax to see how it behaves? Thanks.
Same behavior. So we can say that the "problem" is in version 2.1 of primefaces...
Danilo G. Magrini - Brazil
http://twitter.com/daniloMagrini
Mojarra 2.0.3 / Glassfish v3 / Primefaces 2.2RC1 / Netbeans 6.9
http://twitter.com/daniloMagrini
Mojarra 2.0.3 / Glassfish v3 / Primefaces 2.2RC1 / Netbeans 6.9
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
So f:ajax and p:commandButton behave same in 2.2.M1? So yes 2.1 sounds like violating the JSF spec
-
- Information
-
Who is online
Users browsing this forum: No registered users and 38 guests