Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sample Analysis of MyServlet Code

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the example analysis of MyServlet code, which is very detailed and has certain reference value. Friends who are interested must finish it!

Server: jrun4

Component: flash remoting components as2.0

Software: flash mx 2004 pro

After installation, open the management page of jrun4. After entering the page, you will see that jrun has created three servers, namely admin,default and samples. The server we use is default. For the usage related to flashremoting, please refer to the flashremoting practice of lwanchen (3)-hello world for java: http://www.riacn.com/web/showArticle.asp?id=111.

1. Add the following tag to the web.xml of C:\ jrun4\ servers\ default\ default-ear\ default-war\ WEB-INF:

MyServlet MyServlet This is a servlet of H2O MyServlet

two。 Put the compiled MyServlet.class servlet in 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. The calling method in flash mx 2004 pro is:

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);} above is all the content of the article "sample Analysis of MyServlet Code". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report