3 Replies Latest reply on Aug 9, 2009 6:54 PM by Sven Volker Nowarra

    Beginners Question - SEAM SLSB

    Sven Volker Nowarra Newbie


      I last recently started with SEAM, and got the examples running (booking ...). So far promising. Next step was to use an easy, existing database, along with seam-generate. works ;-)
      Now I want to extend it. I want a new action method (via a  button), that calls my SLSB - I somehow don't get it ...
      I understand I need a calling xhtml page with the button, a SLSB and a home interface - how do they interact ?

      Here is the source code I use:

      XHTML page

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
           <ui:define name="body">
              <f:facet name="header">S V N T E S T</f:facet>
          <s:decorate id="svntest" template="layout/edit.xhtml">
               <ui:define name="label">svntest</ui:define>
                  <div class="actionButtons">
                       <h:commandButton id="svntest" value="svntest" action="#{companylist.svntest}"/>

      and here the JAVA CompanyListAction.java SLSB:

      package com.mydomain.Money_Transfer;
      import javax.ejb.Stateless;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.faces.FacesMessages;
      import org.jboss.seam.log.Log;
      public class CompanyListAction implements CompanyList
           private Log log;
           public String CompanyList()
                log.info("CompanyList(): Company listing returned");
                FacesMessages.instance().add("CompanyList(): Company listing failed");
                return "/home.xhtml";
           public String svntest()
                log.info("svntest(): svntest ...");
                FacesMessages.instance().add("svntest(): in svntest");
                return "/home.xhtml";

      and here the interface:

      package com.mydomain.Money_Transfer;
      import javax.ejb.Local;
      public interface CompanyList
      public String CompanyList();
      public String svntest();

      I don't see anything in my logs, nor any activity on the html page. I can click the button several times, but nothing happens.
      I simply don't understand, how the XHTML button calls the java code... Can someone shed some light in my knowledge darkness ?
      (didn't find it in the tutorials, nor in SEAM in ACTION explained) - thx


        • 1. Re: Beginners Question - SEAM SLSB
          Nikos Paraskevopoulos Novice

          Make sure that there is a <h:form> enclosing your button!

          Seam is rather advanced... I'd suggest you had some experience in JSF+Facelets+EJB+Your application server of choice before using it, or your will easily get lost.

          • 2. Re: Beginners Question - SEAM SLSB
            Arbi Sookazian Master

            <h:form> is definitely required (you are either invoking a HTTP POST or HTTP GET request and for a form, it's a POST).

            I would take Nikos' advice very seriously.  I had one hell of a time learning this tech stack and one of the reasons is the only part of it I had previous experience in was EJB2.1.

            Look up 'proxy' in Seam in Action.

            In EJB 3.1, the local interface will no longer be required.

            Also, I would use POJOs rather than EJBs at first, they're simpler and better for productivity in terms of no local interface to code and maintain and faster dev/test cycles with hot incremental deployment for JavaBeans (not for EJB classes).

            • 3. Re: Beginners Question - SEAM SLSB
              Sven Volker Nowarra Newbie


              went out 4 weeks for holidays, to work intensivly with SEAM - I still like it !
              The answer to my original request can be found in the book Seam in action by Dan Allen (covers SEAM 2), chapter 4, and there especially 4.4.1 - this thread can be closed.

              --- Currently reading "Seam in Action" by Dan Allen and "JBOSS SEAM" by Bernd Mueller (German book).