问题描述
限时送ChatGPT账号..我正在尝试使用 Java 脚本从纯 HTML 页面调用 Web 服务.我已经成功地在 net bean 上使用 java 创建了一个 web 服务.现在我想使用 java 脚本从该 Web 服务调用一个方法,并向 Web 服务发送一些参数,到目前为止我已经尝试过但还没有成功.我已经使用jsp页面成功调用了该方法,但我需要使用简单的html页面来完成.
i am trying to call a web service from my pure HTML page using java script. i had successfully created a web service using java on net beans. now i want to call a method from that web service using java script with sending some parameters to the web Service, i had tried so far but not succeed yet. i had successfully called the method using jsp page, but i need to do it by using simple html page.
我看过一个例子这里但它是不和我一起工作.:(
i had seen an example Here but it is not working with me. :(
你能给我一些例子,以便我知道如何通过向 Web 服务发送一些参数来从 Java 脚本调用我的 Web 服务的特定方法.
can you please give me some example, so that i come to know how to call a specific method of my web service from java script with sending some parameters to the web service.
提前致谢.
编辑
我的脚本
function validateForm(frm)
{
document.forms[0].action="http://localhost:8084/Web_Service_Example/CircleFunctions?"
document.forms[0].method="post"
document.forms[0].submit()
}
我的 CircleFunctions 方法
my CircleFunctions method
public class CircleFunctions {
public int sum()
{
int a = 20;
int b = 40;
int c = a+b;
return c;
}
}
推荐答案
document.forms[0].action="http://localhost:8080/webservice/services/add"
document.forms[0].method="get"
document.forms[0].submit()
这篇关于如何从java脚本调用我的Web服务的特定方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论