有用到seam remote的吗? 进来帮忙看看
yuzexu
2008-10-27
web.xml
<servlet> <servlet-name>Seam Resource Servlet</servlet-name> <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Seam Resource Servlet</servlet-name> <url-pattern>/seam/resource/*</url-pattern> </servlet-mapping> <servlet> <servlet-name>Seam Remoting</servlet-name> <servlet-class>org.jboss.seam.remoting.SeamRemotingServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Seam Remoting</servlet-name> <url-pattern>/seam/remoting/*</url-pattern> </servlet-mapping> @Name("testremoteAction") @Scope(ScopeType.SESSION) public class RemoteAction implements DocNodeRemote{ public void sayHello() { System.out.println("ddd"); } } @Local public interface DocNodeRemote { @WebRemote public void sayHello(); } <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>Seam Remoting - Hello World Example</title> </head> <body> <h1>Seam Remoting - Hello World Example</h1> <p> </p> <s:remote include="testremoteAction"></s:remote> <script type="text/javascript"> function sayHello() { alert("pp"); alert(Seam.Component.getInstance("testremoteAction")); Seam.Component.getInstance("testremoteAction").sayHello(); } function sayHelloCallback(result) { alert(result); } </script> <button onclick="javascript:sayHello()">Say Hello</button> </body> </html> the Seam.Component.getInstance("testremoteAction") 是能得到的 || 但是 sayHello方法是没被调用的 |
|
andyhan
2008-10-27
会不会和
@Scope(ScopeType.SESSION) 有关系? |
|
Anatorian
2008-10-28
对于java bean, @WebRemote 不要放到接口上,要放到实现类上。
|
|
yuzexu
2008-10-29
这都试过,但不行
|
|
SSailYang
2008-10-29
调试一下了,不行的话在用firebug看看页面有没有问题
|
|
打倒小日本
2008-10-30
引用remote.js文件了么?
<a4j:loadScript src="seam/resource/remoting/resource/remote.js"/> |
|
andyhan
2008-10-31
打倒小日本 写道 引用remote.js文件了么?
<a4j:loadScript src="seam/resource/remoting/resource/remote.js"/> 这个隐含在<s:remote include="testremoteAction"></s:remote>里面了。 怀疑是他打包有问题,或者是seam的版本问题,贴出的代码没有其它问题了,我在jboss-seam 2.1.0.GA下测试通过。 |