引用
蒋委员长 的 Eclipse的插件安装
众所周知,Eclipse无法方便快速的开发Swing程序。因为Eclipse没有自带图形化编码窗口,如果要开发图形化程序,只有手动敲代码非常不方便。现在有一个插件Jigloo提供图形化程序开发窗口,可以即拖即显。如何将它安装到Eclipse当中呢?
安装插件一般使用Link方式:Link意味链接,Eclipse加载时通过链接找到安装的插件

如上图所示:我的Eclipse路径C:\Program Files\Eclipse 然后将Jigloo解压到Eclipse安装目录中。这里需要注意Jigloo目录下必须要有个叫Eclipse的目录,Eclipse的目录下才是放入features和plugins目录。以上图为例:C:\Program Files\Eclipse\Jigloo\Eclipse 路径里放入features和plugins目录,即features目录路径为:C:\Program Files\Eclipse\Jigloo\Eclipse\features,plugins目录路径为:C:\Program Files\Eclipse\Jigloo\Eclipse\plugins  这里必须要强调目录路径,因为我使用的是Link方式安装插件。
插件安装位置正确后,就该链接了(Link)。在Eclipse路径C:\Program Files\Eclipse下建立一个links目录(必须这个名字),并在links目录下建立一个Jigloo.link的文件(文件名必须同插件目录名相同,后缀名必须是link)。最后用记事本打开Jigloo.link文件,填入path = Jigloo(path = 插件目录名)。保存后,重新启动Eclipse。如下图

在新建项目中出现了一个叫GUI Forms的项目,说明插件安装成功,这就是Jigloo插件提供的图形化开发工具。
写在最后:
向大家推荐一个插件Aptana,这个插件可以调试Javascript代码和HTML代码。此插件还是第一款支持ajax调试的程序。详见http://www.aptana.com/  插件下载地址http://update.aptana.com/install/studio/3.2/

因为新版本要收费(只有一个月免费试用),我使用的老版本,安装到Eclipse中有3个按钮(如上图,黄色惊叹号和红色叉)
如题,废话不多说。
JSP页面
hello.jsp
<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>AJAX提交页面</title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<script type="text/javascript" src="ajax.js"></script>
   <script type="text/javascript">
   function doso(){
     var url = "actAction.do";
     var s="武晓强斯蒂芬34-*(&_(*!$^_*!&#!^$+!*#&&";
     s=encodeURIComponent(s);      //转换特殊字符
     var parameter ="name="+s+"&email=abc@abc.com&www=http://wxq594808632.blog.163.com/";
     var method = "POST";
     function callBack(text){           //回调函数
      alert("调用成功!\n名字为:"+text);
     }
   new Ajax().ajaxRequest(url,parameter,method,callBack);     //调用方法发送Request
   }
   </script>
</head>
<body>
<input type="button" value="提交" onclick="doso()"/>
   </body>
</html>
 
java类
ActAction.java
package ajaxpost;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.Action;
import java.io.UnsupportedEncodingException;
import java.io.IOException;
import java.io.PrintWriter;
public class ActAction extends Action {
    public ActionForward execute(ActionMapping mapping, ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response) throws
            UnsupportedEncodingException {
        //设置字符编码返回的编码
        response.setContentType("text/html;charset=UTF-8");
        //接收字符的编码
        try {
            request.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        PrintWriter out = null;
        try {
            out = response.getWriter();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        String name = request.getParameter("name");
        String email = request.getParameter("email");
        String www = request.getParameter("www");
        System.out.println(email);
        System.out.println(name);
        System.out.println(www);
     //   out.print(name+"\n"+email+"\n"+www);
        out.print(name);         //返回值
        return null;
    }
}
最重要滴
ajax.js
我用别人的。感谢这位大哥。。
/*
author zhangshuling
email  zhangshuling1214@126.com
*/
function  Ajax(){
    var _xmlHttp = null;
 this.createXMLHttpRequest = function(){
  try{
   if (window.ActiveXObject) {                                                     
    _xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");                                      
   }                                                                               
   else if (window.XMLHttpRequest) {                                                   
    _xmlHttp = new XMLHttpRequest();                                                
   }
  }catch(e){
     alert(e.name +" : " + e.message);
  }
 }
 
 this.backFunction = function(_backFunction){
  if(_xmlHttp.readyState == 4) {
   if(_xmlHttp.status == 200) {
    _backFunction(_xmlHttp.responseText);//这里可以设置返回类型
   }
  }
   _xmlHttp.onreadystatechange = null;
 }
 this.doPost = function(_url,_parameter,_backFunction){
     try{
      _xmlHttp.open("POST",_url, false); 
   _xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
   _xmlHttp.send(_parameter); 
   }catch(e){
    alert(e.name +" : " + e.message);
     }
 }
 
 this.doGet = function(_url,_parameter,_backFunction){
    try{
        var _random = Math.round(Math.random()*10000);
        _xmlHttp.open("GET", (_url+"?random=" +_random +"&" + _parameter), false); 
     _xmlHttp.send(null); 
   }catch(e){
      alert(e.name +" : " + e.message);
   }
 }
 
    this.ajaxRequest = function(_url,_parameter,_method,_backFunction){
          try{
            this.createXMLHttpRequest();
         if(_method.toLowerCase() == "post"){
            this.doPost(_url,_parameter,_backFunction);
         }else{
            this.doGet(_url,_parameter,_backFunction);  
         }
         try{
           _xmlHttp.onreadystatechange = this.backFunction(_backFunction);
         }catch(err){
            //??????IE?????????????????
         }
      }catch(e){
      alert(e.name +" : " + e.message);
   }
     }
} 
/*
 var url = "ajax.do";
 var parameter = "parameter=parameter";
 var method = "post" 
 
 function callBack(text){
  ....
 }
 
 new Ajax().ajaxRequest(url,parameter,method,callBack);
*/
 
经过本人FF,IE6,IE7,测试。完全好用
import java.io.IOException;
import java.awt.image.BufferedImage;
import java.net.URL;
import java.io.BufferedInputStream;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.File;
import javax.imageio.ImageIO;
public class Img2 {
//读取远程url图片,得到宽高
    public int[] returnImgWH(String imgurl) {
        boolean b=false;
        try {
            //实例化url
            URL url = new URL(imgurl);
            //载入图片到输入流
            java.io.BufferedInputStream bis = new BufferedInputStream(url.openStream());
            //实例化存储字节数组
            byte[] bytes = new byte[100];
            //设置写入路径以及图片名称
            OutputStream bos = new FileOutputStream(new File( "C:\\thetempimg.gif"));
            int len;
            while ((len = bis.read(bytes)) > 0) {
                bos.write(bytes, 0, len);
            }
            bis.close();
            bos.flush();
            bos.close();
            //关闭输出流
            b=true;
        } catch (Exception e) {
            //如果图片未找到
            b=false;
        }
        int[] a = new int[2];
        if(b){    //图片存在
            //得到文件
            java.io.File file = new java.io.File("C:\\thetempimg.gif");
            BufferedImage bi = null;
            try {
                //读取图片
                bi = javax.imageio.ImageIO.read(file);
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            a[0] = bi.getWidth(); //获得 宽度
            a[1] = bi.getHeight(); //获得 高度
            //删除文件
            file.delete();
        }else{     //图片不存在
            a=null;
        }
       return a;
    }
    public static void main(String[] args) {
        Img2 i = new Img2();
        int[] a=i.returnImgWH("http://www.baidu.com/img/baidu_logo.gif");
        if(a==null){
            System.out.println("图片未找到!");
        }else{
            System.out.println("宽为" + a[0]);
            System.out.println("高为" + a[1]);
        }
    }
}