[
http://jira.jboss.com/jira/browse/JBSEAM-685?page=comments#action_12351693 ]
Gavin King commented on JBSEAM-685:
-----------------------------------
OK, the bug is that the conversation id (and all other page context data) is lost when a
page action (or s:link action) causes navigation. The viewroot is discarded, and a new one
created, w/o copying the attributes across.
JSF postback doesn't include conversation identifier
----------------------------------------------------
Key: JBSEAM-685
URL:
http://jira.jboss.com/jira/browse/JBSEAM-685
Project: JBoss Seam
Issue Type: Bug
Components: Core, JSF
Affects Versions: 1.1.1.GA
Reporter: Christian Bauer
Assigned To: Gavin King
Fix For: 1.1.5.GA
I'm at a point where I'm almost certain I have found a bug. It's difficult to
reproduce and isolating it more would cost too much time.
Take a seam-gen project and create a new entity, name it 'Foo'.
Add a page called 'fooDisplay.xhtml' that shows a single Foo object:
Name: <h:outputText value="#{currentFoo.name}"/>
<s:link styleClass="button" value="Edit Foo"
action="edit"/>
Add the outcome to pages.xml:
<page view-id="/fooDisplay.xhtml"
action="#{fooDisplay.resolveFoo}">
<param name="fooId" value="#{fooDisplay.fooId}"
converterId="javax.faces.Long"/>
<navigation from-action="edit">
<render view-id="/foo.xhtml"/>
</navigation>
</page>
So I can call this page now with /docDisplay.xhtml?fooId=123 and I will see the object.
This is the job of the FooDisplay backing bean:
@Name("fooDisplay")
public class FooDisplay {
private Long fooId;
public Long getFooId() { return fooId; }
public void setFooId(Long fooId) { this.fooId = fooId; }
@In(create = true)
private EntityManager entityManager;
@Out(scope = ScopeType.EVENT, required = false)
private Foo currentFoo;
@Transactional
public void resolveFoo() {
entityManager.joinTransaction();
currentFoo = entityManager.find(Foo.class, getFooId());
}
}
The problem occurs when rendering the edit page, foo.xhtml. The processing after a click
on Edit is as follows:
- Restore View /fooDisplay.xhtml
- Run FooDisplay.resolveFoo(), @Out(Event) currentFoo
- Render Response /foo.xhtml, triggers FooHome.create(), @Begin
I've made no changes to this seam-gen produced page, only adapted the Home manager to
accept not a request parameter, but injection:
@Name("fooHome")
public class FooHome extends EntityHome<Foo>
{
@In @Out
Foo currentFoo;
@Override
public Object getId()
{
if (currentFoo==null)
{
return super.getId();
}
else
{
return currentFoo.getId();
}
}
@Override @Begin
public void create() {
super.create();
}
}
(I know that the injection/outjection here is not complete.)
The issue: The long-running conversation identifier is not rendered into the Edit page,
and a click on "Save" or "Update" breaks. The following request does
not contain a conversation identifier.
If I modify the Edit page and use s:button or s:link and not h:commandButton, the
conversation identifier is rendered into the submit and everything works.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira