Excellent!

I just grabbed the latest CVS code and the example works great!

However, I can't seem to make it work in my simple application.  Is there any 
special setup I need to do in order to use the Seam UI components?  I have my 
sample appication working almost identically to the booking example (except the 
link doesn't work).

I am using the latest Seam CVS code (4/9/2006 8:00pm EST).  I have recompiled 
 - jboss-seam.jar
 - and jboss-seam-ui.jar and put it into my war (inside the ear).  

When I navigate to my page that has the <s:link /> and execute the link... the 
link just opens the same view again (the results list).  I am expecting the 
view.xhtml to open.  

Here is the Search Action I am using:

  | package com.sample;
  | 
  | @Name("personFinder")
  | @Stateful
  | @Scope(ScopeType.SESSION)
  | @Interceptors(SeamInterceptor.class)
  | public class ActionPersonFinder implements IPersonFinder, Serializable{
  |    
  |    private static final long serialVersionUID = -730689360852969695L;
  | 
  |    private static final Log log = 
LogFactory.getLog(ActionPersonFinder.class);
  |    
  |    @DataModel
  |    private List<Person> personList;
  | 
  |    @DataModelSelection
  |    private Person selectedPerson;
  | 
  |    @In(create = true)
  |    private EntityManager entityManager;
  | 
  |    @Begin(join=true)
  |    public String find(){
  |       log.fatal("FINDING! em["+entityManager+"]");
  |       
  |       Query query = entityManager.createQuery("from 
com.its.entity.contact.Person");
  |       personList = (List<Person>) query.getResultList();
  | 
  |       log.fatal("FOUND!");
  |       
  |       return "found";
  |    }
  |    
  |    @End
  |    public String cancel(){
  |       return "cancel";
  |    }
  |    
  |    @Destroy
  |    @Remove
  |    public void destroy(){
  |    }
  | 
  |    public Person getSelectedPerson(){
  |       return selectedPerson;
  |    }
  | 
  |    public void setSelectedPerson(Person selectedPerson){
  |       this.selectedPerson = selectedPerson;
  |    }
  |    
  | }
  | 

Here is the search results.xhtml displayed from the "find" method above:

  | <!DOCTYPE html 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:f="http://java.sun.com/jsf/core";
  |       xmlns:h="http://java.sun.com/jsf/html";
  |      xmlns:s="http://jboss.com/products/seam/taglib";
  |       template="template.xhtml">
  |       
  |   <ui:param name="page" value="Two"/>
  |   <ui:define name="title">Person Results Screen</ui:define>
  |   <ui:define name="content"> 
  |     <h:form>
  |        <h:outputText value="No Contacts Found" 
rendered="${personList.rowCount==0}"/>
  |        <h:outputText value="Contacts Found!!!!!!!" 
rendered="${personList.rowCount>0}"/>
  |         <h:dataTable value="${personList}" var="contact" 
rendered="${personList.rowCount>0}">
  |                     <h:column>
  |             <s:link action="${personEditor.view}">
  |                View Link 1
  |                <f:param name="contactId" value="${contact.id}"/>
  |             </s:link>       
  |                     </h:column>
  |                 <h:column>
  |                             <f:facet name="header">ID</f:facet>
  |                     ${contact.id}
  |                     </h:column>
  |                 <h:column>
  |                             <f:facet name="header">First Name</f:facet>
  |                     ${contact.fname}
  |                     </h:column>
  |                 <h:column>
  |                             <f:facet name="header">Last Name</f:facet>
  |                     ${contact.lname}
  |                     </h:column>
  |                 <h:column>
  |                             <f:facet name="header">Oragnization</f:facet>
  |                     ${contact.organization.name}
  |                     </h:column>
  |             </h:dataTable>
  |     </h:form>
  |   </ui:define>
  |   <ui:define name="caption">Person Results Screen</ui:define>
  | 
  | </ui:composition>

The link created on the results screen is:

  | 
http://localhost:8080/facelets-sandbox/results.its?contactId=1&actionMethod=personEditor.view&conversationId=9&dataModelSelection=personList[0]
  | 

I have using propogation="false" on the s:link so that the conversationId is 
not generated.  The results stay the same though.

Here is the edit action.  The @Create method is never called.

  | package com.sample;
  | 
  | 
  | @Stateful
  | @Name("personEditor")
  | @Interceptors(SeamInterceptor.class)
  | @Conversational(ifNotBegunOutcome="noConversation")
  | public class ActionPersonEditor implements IPersonEditor, Serializable{
  |    
  |    private static final long serialVersionUID = -3036136121465320027L;
  | 
  |    private static final Log log = 
LogFactory.getLog(ActionPersonFinder.class);
  |    
  |    @RequestParameter
  |    private Long contactId;
  |    
  |    @Out
  |    private Person contact;
  |    
  |    @Out
  |    private boolean editDisabled = true;
  | 
  |    @In(create = true)
  |    private EntityManager entityManager;
  |    
  |    @In
  |    private ActionPersonFinder personFinder;
  |    
  |    @Create
  |    @Begin
  |    public void initialize(){
  |       System.out.println("CREATE PERSON EDITOR");
  |       //start a new conversation....
  |       contact = entityManager.find(Person.class, contactId);
  |    }
  |    
  |    public String view(){
  |       editDisabled=true;
  |       return "view";
  |    }
  |    
  |    public String edit(){
  |       editDisabled=false;
  |       return "edit";
  |    }
  |    
  |    public String save(){
  |       editDisabled=true;
  |       return "saved";
  |    }
  |    
  |    @End
  |    public String cancel(){
  |       editDisabled=true;
  |       entityManager.refresh(contact);
  |       return "cancel";
  |    }
  |    
  |    @Destroy
  |    @Remove
  |    public void destroy(){
  |    }
  | 
  |    public Person getContact(){
  |       return contact;
  |    }
  |    
  |    public void setContact(Person contact){
  |       this.contact = contact;
  |    }
  | 
  |    public boolean getEditDisabled(){
  |       return editDisabled;
  |    }
  |    
  | }
  | 

I hate to ask people to debug my code; but any thoughts on something I can try 
to get the link to work would be much appreciated.

Thanks,
Chris....

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3936151#3936151

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3936151


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to