7 Replies Latest reply on Dec 23, 2011 6:03 AM by desingraj

    Trouble with WebRemote seam 2.1

    mhiggins.matt.smartdestinations.com
      I have a very simple example that I can't get to work any help would be great.

      I have the following class and interfaces


      The interface

      package com.vo.pt.session;

      import javax.ejb.Local;

      import org.jboss.seam.annotations.remoting.WebRemote;

      @Local
      public interface Ajax {

              @WebRemote
              String sayHello();
      }


      The impl


      package com.vo.pt.session;

      import javax.ejb.Stateless;

      @Stateless
      @Name("ajaxTest")
      public class AjaxImpl implements Ajax {

              public String sayHello(){
                      return "HEllo";
              }
             
      }


      test page
      <!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:s="http://jboss.com/products/seam/taglib"
                      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:a="http://richfaces.org/a4j"
                      xmlns:rich="http://richfaces.org/rich"
                      template="layout/template.xhtml">
                            
      <ui:define name="body">
         <s:remote include="ajaxTest"/>
         <script type="text/javascript">
              //<![CDATA[
        
          var ajaxTest = Seam.Component.getInstance("ajaxTest");
          ajaxTest.sayHello(noop);

              function noop(object){
                      alert(object);
              }
          // ]]>
         </script>
        
      </ui:define>
      </ui:composition>

      http://localhost:8080/pt/seam/resource/remoting/interface.js?ajaxTest

      Seam.Remoting.type.ajaxTest = function() {
        this.__callback = new Object();
      }
      Seam.Remoting.type.ajaxTest.__name = "ajaxTest";

      Seam.Component.register(Seam.Remoting.type.ajaxTest);

      So the interface does no have the call to sayHello on it ? I am sure I am doing something silly ?