代替MyEclipse Blue的免费工具的最佳组合:Eclipse3 + WTP + EclipseUML代

来源:互联网 发布:java办公管理系统 编辑:程序博客网 时间:2024/05/22 09:45
由于要开发websphere6的程序,到网上查找了一下他的开发工具。当然IBM的排出,太贵了。有的文章介绍了MyEclipse Blue但是还是需要钱。最后发现一篇文章介绍了WTP这个工具,它是免费的。具体操作如下:
1、下载Eclipse + JDK我到IBM的网站上下载了IBM_DevelopmentPackage_for_Eclipse_Win32_3.0.0.zip,只需要你注册即可下载。他用的是Eclipse 3.3.1 + IBM Java SDK 6

2、下载EclipseUMLhttp://www.ejb3.org/eclipseUML_E330_2007_freeEdition_3.3.0.v20071210_including_eclipse3.3.zip

3、下载其他的插件http://download.eclipse.org/webtools/downloads/drops/R2.0/R-2.0.2-20080223205547/上下载:emf-sdo-xsd-SDK-2.3.2.zip    GEF-SDK-3.3.2.zip  dtp-sdk_1.52_022008.zipwtp等 然后到www.eclipse.org网站上下载uml2的工具箱

4、将IBM_DevelopmentPackage_for...zip解压到一个目录下

5、将eclipseUML_E330_2007_freeEdition_3.3.0.v20071210_including_eclipse3.3.zip解压到一个目录下参照解压目录下的文件将第3步下载的插件解压后拷贝到第4步Eclipse相应的文件夹下。按照以下的原则:将第3步中没有的插件也拷贝过去,注意就是:EclipseUML + UML2.0工具箱

6、到Tomcat网站上下载Tomcat6.0,注意它安装的时候选择JDK,第4步解压的ibm_sdk60

7、在Eclipse中配置Tomcat60启动Eclipse->windows->Preferences->Server->Installed Runtimes->add->选择Apache Tomcat v6.0->选择Tomcat6安装文件夹->Jre选择Ibm_sdk60即可。
然后启动程序即可。
测试程序如下:
1. File->new->Project->web->Dynamic Web Project,输入Project name 然后选择Tomcat 6即可。
2.添加一个包::test.com.sohu然后添加一个类:TestServlet类.源码如下:
package test.com.sohu;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class TestServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {   static final long serialVersionUID = 1L;       
public TestServlet() {super();}   
 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 response.setHeader("Pragma", "No-cache");
 response.setHeader("Cache-Control","No-cache");
response.setDateHeader("Expires",0);
 response.setContentType("image/gif");
BufferedImage image = new BufferedImage(600,480,BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
g.setColor(new Color(255,255,255));
g.fillRect(0, 0, 600,480);
g.setColor(new Color(0,192,128));
 g.drawString("1号仓", 20, 40);
g.drawRect(1, 1, 30, 10);
 g.dispose();
 ImageIO.write(image, "JPEG", response.getOutputStream());
 }        
}

调用它的test.jsp如下:
<%@ page import="test.com.sohu.*" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%><html><head><meta http-equiv="Content-Type" content="text/html; charset=GB18030"><title><%=GetString.getString() %></title></head><body><form name="form1" method="POST" action="TestServlet"><p><input type="submit" name="Submit" value="画图"></p></form><p><%=GetString.getString() %></p></body></html>

注意:添加Servlet能通过向导添加,Jsp只有源码编辑没有类似Dreamware的功能。

上面的代码的功能:通过java在服务器断画"图“然后在客户端的浏览器上显示。类似报表的功能,稍加修改即变为验证码生成代码。

不足之处请各位老大指教!!!
原创粉丝点击