[JBoss Seam] - Re: Last try - Conversational Feature let me feel like an id
by Delphi's Ghost
anonymous wrote :
| Specifically: Why do you need join="true" if you just have ended the previous conversation with propagation="end"?
|
He talked about starting a new one with join=true. The join=true bit ensures that you don't start a new one each time the page is rendered.
maku01 :
Regarding the conversation tags in pages.xml, I believe (and I could be wrong on this) that you need to rephrase the constant to something like :
| <conversation name="PartnerMaintConv"
| parameter-name="cid"
| parameter-value="#{PartnerMaintConv}"/>
|
The constant should force a reuse of the conversation that you are looking for, although there are some problems with this mechanism which are currently being fixed.
http://jira.jboss.org/jira/browse/JBSEAM-1423
Proper use of conversations has been a thorn in my side for a while. If you notice, most Seam example apps have very little editing in them, and there is no master detail editing involved. The issue tracker was the only one with any kind of editable features, including master/detail and nested editing, but it was pulled in 2.0, possibly because it wasn't working properly.
There is very little in the way of best practices for Seam, and everyone seems to be off doing their own thing and muddling together a solution.
Pete, you've seen my sample bookstore app from my Jira issue (#1423), I have a couple of different ones (including something similar to the issue tracker) that I have been using to test this stuff out. I'm more than happy to donate something. The only caveat is that it uses the same kind of mechanisms as the bookstore app (RESTFul URLS, no @Begin annotations, and parameter passing) since it seems that this is the best way to develop a seam app that is well decoupled and a little more lightweight (i.e. not invoking new beans into a conversation that doesn't need them or is about to end). If you guys are interested, just let me know what I need to do with it to get it up to scratch.
I think the two things seam needs right now is some indication of best practices, and some more diverse examples, and there is some overlap of those two issues.
The documentation and examples are great for describing what you can do, but not always what you should do. There needs to be a little bit more diversity in the examples that highlight how to solve the problems people face on a daily basis, or at least indicate which problems can't be solved so we know we need to design around those issues (i.e. master/detail editing with nested conversations).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081397#4081397
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081397
18 years, 7 months
[JBoss Seam] - Examples about Application Framework (Chapter 11)
by zakmck
Hi all,
I cannot make the examples in chapter 11 working:
http://docs.jboss.com/seam/2.0.0.B1/reference/en/html/framework.html
I've started with Person and PersonHome, with the creation button only. And worked up to that point.
Then I've added update and delete, and I've added a query object, so that I can have an access point to the edit page.
What I get is: 1) Creation still works 2) when I select some item to be updated and I submit the edit form anything is updated. If I click on delete, anything is deleted either 3) After having clicked on update or delete, I am bring back to the creation page (with Create button only)
I've tried to extend update() in PersonHome, to add a logging message, and I may see the method is not called at all, same for delete. I also have tried to add a foo() action to the home, and this isn't called either.
Please find the code below. I am afraid I am missing something important.
Thanks in advance for any help.
Cheers.
Marco.
Person.java
| import java.io.Serializable;
| import javax.persistence.Entity;
| import javax.persistence.GeneratedValue;
| import javax.persistence.Id;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.ScopeType;
|
| @Entity
| public class Person implements Serializable {
| @Id @GeneratedValue private Long id;
| private String name;
|
| public Long getId() { return id; }
| public void setId(Long id) { this.id = id; }
|
| public String getName() { return name; }
| public void setName(String name) { this.name = name; }
| }
|
PersonHome.java
| import javax.ejb.Stateful;
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.*;
| import uk.ac.ebi.microarray.model.Person;
| import org.jboss.seam.framework.EntityHome;
| import org.jboss.seam.annotations.web.RequestParameter;
| import org.jboss.seam.log.Log;
|
| @Name("personHome")
| public class PersonHome extends EntityHome<Person>
| {
| @RequestParameter Long personId;
| @Logger private Log log;
|
|
| public Long getId () {
| return personId;
| }
|
| public void setId ( Long id ) {
| personId = id;
| }
|
|
| @Factory( "person" )
| public Person initPerson () { return getInstance (); }
|
|
| public String update ( )
| {
| log.info ( ">>> Calling PersonHome.update()" );
| return super.update ();
| }
|
| public String persist ( )
| {
| log.info ( ">>> Calling PersonHome.persist()" );
| return super.persist ();
| }
|
|
|
| public String foo ( )
| {
| log.info ( ">>> Calling PersonHome.foo()" );
| return super.update ();
| }
|
|
| }
|
person.xhtml
| <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| template="layout/template.xhtml">
|
| <ui:define name="body">
|
|
| <h1>
| <h:outputText rendered = "#{!personHome.managed}" value = "New Person" />
| <h:outputText rendered = "#{personHome.managed}" value = "Edit Person" />
| </h1>
|
| <h:form>
| Name: <h:inputText value="#{person.name}"/><br/><br/>
|
| <div>
| <h:commandButton value="Create Contact" action="#{personHome.persist}" rendered="#{!personHome.managed}"/>
| <h:commandButton value="Update Contact" action="#{personHome.update}" rendered="#{personHome.managed}"/>
| <h:commandButton value="Delete Contact" action="#{personHome.remove}" rendered="#{personHome.managed}"/>
| <h:commandButton value="Foo" action="#{personHome.foo}" rendered="#{personHome.managed}"/>
| </div>
|
| </h:form>
|
| <h:messages styleClass="message"/>
|
| </ui:define>
|
| </ui:composition>
|
people.xhtml
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:s="http://jboss.com/products/seam/taglib"
| template="layout/template.xhtml"
| >
|
| <ui:define name="body">
|
| <h1>List of people</h1>
|
| <h:dataTable value="#{people.resultList}" var="person">
| <h:column>
| <s:link view="/person.seam" value="#{person.name}">
| <f:param name="personId" value="#{person.id}"/>
| </s:link>
| </h:column>
| </h:dataTable>
|
| </ui:define>
|
| </ui:composition>
|
|
Also I have the parameter specification in pages.xml:
| <page view-id="/person.xhtml">
| <param name="personId" value="#{person.id}"/>
| </page>
|
And the query spec in components.xml:
| <framework:entity-query name="people" ejbql="select p from Person p"/>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081383#4081383
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081383
18 years, 7 months