1 Reply Latest reply on Mar 3, 2009 11:16 PM by ron_sigal

    Problem of remoting in ajax with jseam

      Hi everybody:
      I'm studying ajax in JSeam using remoting and got stuck with the helloworld demo.

      The java code:
      @Local
      public interface Hello {
      @WebRemote
      public String sayHello(String name);
      }
      @Stateful
      @Scope(SESSION)
      @Name("helloAction")
      public class HelloAction implements Hello{
      public String sayHello(String name) {
      System.out.println("get name:"+name);
      return "Hello, " + name;
      }

      @Remove
      public void destroy() {
      }
      }

      The .xhtml:
      <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:s="http://jboss.com/products/seam/taglib">






      <!-- tried,no use
      <s:remote include="helloAction"></s:remote>
      -->


      function sayHello() {
      var name='zwz';
      Seam.Component.newInstance("helloAction").sayHello(name, sayHelloCallback);
      }

      function sayHelloCallback(result) {
      alert(result);
      }


      Say Hello




      The part of web.xml about jseam:

      <listener-class>
      org.jboss.seam.servlet.SeamListener
      </listener-class>



      <servlet-name>Seam Resource Servlet</servlet-name>
      <servlet-class>
      org.jboss.seam.servlet.ResourceServlet
      </servlet-class>


      <servlet-mapping>
      <servlet-name>Seam Resource Servlet</servlet-name>
      <url-pattern>/seam/resource/*</url-pattern>
      </servlet-mapping>


      <filter-name>Seam Filter</filter-name>
      <filter-class>org.jboss.seam.web.SeamFilter</filter-class>


      <filter-mapping>
      <filter-name>Seam Filter</filter-name>
      <url-pattern>/*</url-pattern>
      </filter-mapping>


      <servlet-name>Seam Remoting</servlet-name>
      <servlet-class>
      org.jboss.seam.remoting.SeamRemotingServlet
      </servlet-class>


      <servlet-mapping>
      <servlet-name>Seam Remoting</servlet-name>
      <url-pattern>/seam/remoting/*</url-pattern>
      </servlet-mapping>

      The faces-config.xml :

      <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>


      The components.xml :
      <core:init jndi-pattern="JSeamDemo_Remote/#{ejbName}/local"
      debug="true" />

      <core:manager conversation-timeout="120000" />


      true



      true



      The .xhtml page have javascript error, said "Seam.Component." method doesn't exist.
      I use JBoss AS 5, JSeam2.1.1,IE7.
      And I'm still confused about the code in .xhtml:


      where is the js file, which host is it on?
      Can anyone help me ?
      Thanks a lot.