新聞中心
服務(wù)器:jrun4

為順昌等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及順昌網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為成都做網(wǎng)站、網(wǎng)站建設(shè)、順昌網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!
組件:flash remoting components as2.0
軟件:flash mx 2004 pro
在安裝好后,打開jrun4的管理頁面,進入頁面之后你會看到j(luò)run已經(jīng)創(chuàng)建好了3個服務(wù)器,分別是admin,default和samples,我們使用的服務(wù)器為default,對與flash remoting的相關(guān)用法可參照lwanchen的flashremoting實踐(三)-hello world for java:http://www.riacn.com/web/showArticle.asp?id=111
1.在C:\jrun4\servers\default\default-ear\default-war\WEB-INF的web.xml中加入以下的標記:
MyServlet MyServlet This is a servlet of H2O MyServlet
2.將編譯好的MyServlet.class這個servlet放在classes
- import javax.servlet.*;
- import java.io.IOException;
- import java.util.List;
- public class MyServlet implements Servlet {
- private String message = null;
- public void init(ServletConfig config) throws ServletException {
- message = "Hello from MyServlet";
- }
- public void service(ServletRequest request, ServletResponse response)
- throws ServletException, IOException {
- request.setAttribute("FLASH.RESULT", message);
- }
- public String getServletInfo() {
- return "A test servlet.";
- }
- public ServletConfig getServletConfig() {
- return null;
- }
- public void destroy() {
- message = null;
- }
- }
3.在flash mx 2004 pro中的調(diào)用方法為:
- import mx.remoting.NetServices;
- import mx.remoting.Connection;
- NetServices.setDefaultGatewayUrl(http://localhost:8100/flashservices/gateway)
- gatewayConnnection = NetServices.createGatewayConnection();
- flashtestService = gatewayConnnection.getService("",this);
- flashtestService.MyServlet();
- function MyServlet_Result(result){
- users= result; trace(users);
- }
ok! MyServlet就是這么簡單,但可花費了我不少的心血呀,希望大家珍惜,也祝大家能一次搞定!
網(wǎng)頁題目:詳細介紹MyServlet代碼
鏈接分享:http://www.5511xx.com/article/djpshci.html


咨詢
建站咨詢
