Java 无法在GWT上调用服务
我正在GWT上测试一个示例web应用程序,我下载了所有SDK,并在eclipse上设计了一个插件 小表单,从用户处获取很少的输入,当用户点击按钮时,它正在使用RPC调用服务, 现在它的给出错误“ signup.htmlJava 无法在GWT上调用服务,java,gwt,gwt-rpc,Java,Gwt,Gwt Rpc,我正在GWT上测试一个示例web应用程序,我下载了所有SDK,并在eclipse上设计了一个插件 小表单,从用户处获取很少的输入,当用户点击按钮时,它正在使用RPC调用服务, 现在它的给出错误“ signup.html @RemoteServiceRelativePath("SignUpservlet") 用于注册的包装HTML 自从将添加到GWT.xml之后,您是否进行了GWT编译 从这个错误看来,您的应用程序希望servlet映射到默认的完全限定模块名下:RequestURI=/com.
@RemoteServiceRelativePath("SignUpservlet")
用于注册的包装HTML
自从将
添加到GWT.xml之后,您是否进行了GWT编译
从这个错误看来,您的应用程序希望servlet映射到默认的完全限定模块名下:RequestURI=/com.mpigeon.foofy.signup.signup/SignUpservlet
@RemoteServiceRelativePath("../foofysignup/SignUpservlet")
与
rpc请求应该可以工作。这不是一个好的解决方案,但至少可以工作
正如Terrell所指出的,您的应用程序正在从/com.mpigeon.foofy.signup.signup/
加载,但由于您的重命名为属性,您的应用程序应该从/foofysignup/
加载。这可能是由WebContent文件夹中的旧文件引起的
你能发布你的SignUp.html吗?嗨,谢谢你的建议,我试过编译这个项目,它也会出现同样的错误。谢谢彼得,我已经替换了代码,它工作得很好,但基本上我们不应该提供绝对路径权限。我希望
src=“foofysignup/com.mpigeon.foofy.SignUp.SignUp.nocache.js”
而不是src=”/com.mpigeon.foofy.signup.signup.nocache.js“
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Servlets -->
<servlet>
<servlet-name>fsignup</servlet-name>
<servlet-class>com.mpigeon.foofy.signup.server.SignupServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>fsignup</servlet-name>
<url-pattern>/foofysignup/SignUpservlet</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>SignUp.html</welcome-file>
</welcome-file-list>
</web-app>
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.mpigeon.foofy.signup.shared.SignUpFields;
@RemoteServiceRelativePath("SignUpservlet")
public interface SignupService extends RemoteService {
public String StoreSignUp(SignUpFields obj) throws IllegalArgumentException;
}
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!-- -->
<!-- Consider inlining CSS to reduce the number of requested files -->
<!-- -->
<link type="text/css" rel="stylesheet" href="SignUp.css">
<!-- -->
<!-- Any title is fine -->
<!-- -->
<title>Wrapper HTML for SignUp</title>
<!-- -->
<!-- This script loads your compiled module. -->
<!-- If you add any GWT meta tags, they must -->
<!-- be added before this line. -->
<!-- -->
<script language="javascript" src="/com.mpigeon.foofy.signup.SignUp.nocache.js"></script>
</head>
<!-- -->
<!-- The body can have arbitrary html, or -->
<!-- we leave the body empty because we want -->
<!-- to create a completely dynamic ui -->
<!-- -->
<body>
<!-- OPTIONAL: include this if you want history support -->
<iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
<div id="signupdiv"></div>
</body>
</html>
@RemoteServiceRelativePath("SignUpservlet")
@RemoteServiceRelativePath("../foofysignup/SignUpservlet")