One thing behaved strangely after I migrated my code to Seam 2.0 CVS. Say there
is code like this:
| @Stateful
| @Scope(CONVERSATION)
| @Name("strange")
| public class StrangeBacking implements Serializable, Strange{
| @In EntityManager em;
| private List<Something> somethings;
|
| // getter and setter of somethings
|
| public void action1(){
| this.somethings = em.createQuery("...").getResultList();
| }
|
| public void action2(){
| this.somethings = null;
| }
|
| public void action3(){
| // the code does not touch the list somethings;
| }
| }
|
|
In the test.xhtml, there's something like this:
|
| ...
| <h:commandButton action="#{strange.action1}", value="action 1",
type="submit" />
|
| ...
| <h:commandButton action="#{strange.action2}", value="action 2",
type="submit" />
|
| ...
| <s:button action="#{strange.action3}", value="action 3" />
| <h:form rendered="#{strange.somethings == null}">
| ...
| </h:form>
|
Prior to the migration the form was successfully rendered after clicking the
buttons in this sequence: action 1 --> action 2 --> action 3. But today it does
not work. I used SeamTest to see if the list somethings was really nulled out
in the method action2(), the test passed. But when I looked into the seam debug
page, "somethings" always happily sat in the conversation context, not nulled
out!?
My current fix was like this:
| public void action2(){
| this.somethings.clear();
| }
|
| and in the test.xhtml:
|
| <h:form rendered="#{empty strange.somethings}">
| ...
| </h:form>
|
Then the form got rendered. But I do not understand this. Why the list
somethings in the conversation context cannot be nulled out but can be cleared
out? Any enlightenment would be highly appreciated!
Regards,
Ellen
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058445#4058445
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4058445
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user