|
java类见附件:
我部署在Tomcat 5.0\webapps\ROOT\WEB-INF\classes目录下面,Tomcat 5.0\webapps\ROOT\WEB-INF\web.xml配置如下:
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/servlet/helloworld</url-pattern>
</servlet-mapping>
在IE输入:http://localhost:8080/servlet/helloworld 访问成功!
但是我在X3里通过THessianSever加载不进来,Tomcat服务也是启动的!代码如下:
procedure TMainForm.HessianSeverClick(Sender: TObject);
var
o: object;
i: Integer;
begin
FServer := THessianSever.Create('http://localhost:8080/servlet/helloworld');
FServer.JavaClassMapping.Add('HelloWorld', HelloWorld);
o := FServer.Call('add', [1, 2]);
i := Integer(o);
JSDialogs.ShowMsg(SysUtils.IntToStr(i), 'add');
end; |
|