推荐一个免费的支持JSP、Servlet的web hosting

王朝java/jsp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

地址:http://www.mycgiserver.com

该web hosting提供5M的免费空间,并且支持JSP、Servlet,还有Hypersonic数据库提供。我试下来感觉速度还可以,有4万多用户在使用,稳定性应该可以保证。对于J2EE方面的新手,申请一个用来练练手还是不错的。:)

申请很简单,只要singup,然后通过一封email激活即可。

1.对于JSP,开通以后有一个默认的测试页面helloworld.jsp,只要输入相应网址就可以运行了,看看我的吧:http://www.myjavaserver.com/~passant/helloworld.jsp

2.对于servlet,该空间不提供自定义的web.xml的设置,大家共用相同的配置,我摸索了一下,终于知道应该这么来使用:

首先写的servlet要放在自己申请的用户名的包中,即要这么写:package username

比如这个例子:

package passant.hello;

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

import java.util.*;

public class Hello extends HttpServlet {

static final private String CONTENT_TYPE = "text/html; charset=GBK";

//Initialize global variables

public void init() throws ServletException {

}

//Process the HTTP Get request

public void doGet(HttpServletRequest request,

HttpServletResponse response)

throws ServletException, IOException {

response.setContentType(CONTENT_TYPE);

PrintWriter out = response.getWriter();

out.println("<html>");

out.println("<head><title>Hello</title></head>");

out.println("<body>");

out.println("<p>hello ,这是servlet的例子.at : "+new Date()+"</p>");

out.println("</body></html>");

}

//Clean up resources

public void destroy() {

}

}

把上面的文件放在目录 passant/hello/ 中,编译后,将目录hello/以及下面的文件一起上传。注意:不是目录passant/hello/(比较怪的地方)。然后运行要这样:http://www.myjavaserver.com/servlet/passant.hello.Hello

OK,搞定。

3.对于提供的数据库的使用我还没试过,有兴趣的可以看看下面这篇文章,应该是蛮详细的:http://www.myjavaserver.com/~buman/tutorial.html

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航