??xml version="1.0" encoding="utf-8" standalone="yes"?>日韩一区二区不卡,国产精品亚洲综合天堂夜夜 ,大香伊人久久精品一区二区http://www.aygfsteel.com/wxq594808632/差距是差距zh-cnThu, 19 Jun 2025 15:36:58 GMTThu, 19 Jun 2025 15:36:58 GMT60[导入]引用 如何class打包exe文ghttp://www.aygfsteel.com/wxq594808632/archive/2009/04/08/268124.html武志?/dc:creator>武志?/author>Wed, 08 Apr 2009 08:28:00 GMThttp://www.aygfsteel.com/wxq594808632/archive/2009/04/08/268124.htmlhttp://www.aygfsteel.com/wxq594808632/comments/268124.htmlhttp://www.aygfsteel.com/wxq594808632/archive/2009/04/08/268124.html#Feedback0http://www.aygfsteel.com/wxq594808632/comments/commentRss/268124.htmlhttp://www.aygfsteel.com/wxq594808632/services/trackbacks/268124.html

 

引用

蒋委员长 ?如何class打包exe文g
class文g打包exe文g要经q两个步骤:(x)
W一步:(x)class文g打包成jar文gQ请参见我的上一文章:(x)http://maidini.blog.163.com/blog/static/37762704200848910573/
W二步:(x)jar文g打包成exe文g。这是今天的重点

jar打包exe 有许多工P我以exe4jZ详解打包q程Q?BR>W一步:(x)下蝲exe4j,最新版本ؓ(f)4.1 如下?exe4j的官方网?/A> 


W二步:(x)q行exe4j.exe 我用的是免安装?zip) 如下?BR>

W三步:(x)q行软gexe4jQ然后点击Next


W四步:(x)选择W二?JAR in EXE mode"Q然后点击Next


W五步:(x)在General中填入名Uͼ在Directories填入生成exe的目录位|。如下图Q我生成exe目录讄为C:\ok Q然后点Next


W六步:(x)Executable name处填入生成exe文g的名UͼIcon File处填写图标文件位|,再点Next


W七步:(x)首先讄Class Path的位|,即jar文g的位|。然后点OK


W八步:(x)接着讄Main-Class 的位|,即mainҎ(gu)所在的位置。然后点OK 如下?BR>

讄完成后,如下图:(x) 一定要先设|Class PathQ再讄Main class


W九(ji)步:(x)填写版本P最好不要填写第二项。否则可能造成错误(见后?Q最后点击Finish卛_


错误内容QNo JVM could be found on your system. Please define EXE4J_JAVA_HOME to point to an installed JDK or JRE or download a JRE from www.java.com
当时出现q个错误Q查看了(jin)JDK和JRE都没有问题,exe4j也是最新版。后来才发现是设|?Maximum version"。如果不填写"Maximum version"Q就不报错。也不知道是不是exe4j的BUG


W十步:(x)完成所有设|,点击“Click Here to Start the Application”可以运行测试生成的EXE文g


生成的最l的EXEE序Q双ȝ接运行。现在可以把自己写的程序发l朋友们玩玩啦,呵呵




文章来源:http://wxq594808632.blog.163.com/blog/static/10907975520093842753860

]]>
[导入]引用 如何Class打包Jar文g--Eclipsehttp://www.aygfsteel.com/wxq594808632/archive/2009/04/08/268125.html武志?/dc:creator>武志?/author>Wed, 08 Apr 2009 08:27:00 GMThttp://www.aygfsteel.com/wxq594808632/archive/2009/04/08/268125.htmlhttp://www.aygfsteel.com/wxq594808632/comments/268125.htmlhttp://www.aygfsteel.com/wxq594808632/archive/2009/04/08/268125.html#Feedback2http://www.aygfsteel.com/wxq594808632/comments/commentRss/268125.htmlhttp://www.aygfsteel.com/wxq594808632/services/trackbacks/268125.html

 

引用

蒋委员长 ?如何Class打包Jar文g--Eclipse
开发环境:(x)Eclipse + Win XP SP2
使用插gQFatjar、Jigloo

闲话说Q直接切入正题。首先打开EclipseQ创Z个Java工程。如下图Q我机子上的是JDK1.6


W二步:(x)用Jigloo插g创徏一个窗体,Z(jin)更明显演C我窗体名字修改ؓ(f)“这是一个测试程序”。如下图Q?A>


W三步:(x)现在p运行正常的javaE序打包成jar文g。我使用Fatjar插g打包相当方便、傻瓜。直接右键选择要打包的工程Q弹出的菜单中选择“Build Fat Jar”。如下图Q?BR>

W四步:(x)弹出对话框,需要将引导路径修改Q其他选项使用默认讄Q然后点击Finish?SPAN style="COLOR: rgb(255,0,0)">“Main-Class”这修改ؓ(f)MainҎ(gu)所在的文g。此步不可缺,否则打包的Jar文g双击不可q行?/SPAN>


E等一下,打包成功如下图Q出C个testexe_fat.jar文g?BR>

q入工程所在的目录也可以看C个testexe_fat.jar文gQ双dQ就q行?jin)。如果无误应该弹出像?的界?/A>。如下图:


选择jar文g右键Q点击open。相当于双击jar文g如下?


ȝQ打包Jar文g是将分散Class文gl一装的好办法。双击运行速度与没打包前运行速度没有区别。打包一定要讄好Main-Class的\径,否则JVM找不到入口程序?BR>
如果不知道如何在Eclipse中安装插Ӟ请参见我的另一文章:(x)http://maidini.blog.163.com/blog/static/37762704200832671334860/



文章来源:http://wxq594808632.blog.163.com/blog/static/1090797552009384273607

]]>
[导入]引用 Eclipse的插件安?/title><link>http://www.aygfsteel.com/wxq594808632/archive/2009/04/08/268126.html</link><dc:creator>武志?/dc:creator><author>武志?/author><pubDate>Wed, 08 Apr 2009 08:26:00 GMT</pubDate><guid>http://www.aygfsteel.com/wxq594808632/archive/2009/04/08/268126.html</guid><wfw:comment>http://www.aygfsteel.com/wxq594808632/comments/268126.html</wfw:comment><comments>http://www.aygfsteel.com/wxq594808632/archive/2009/04/08/268126.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/wxq594808632/comments/commentRss/268126.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/wxq594808632/services/trackbacks/268126.html</trackback:ping><description><![CDATA[<div><P> </P> <P><EM>引用</EM></P> <BLOCKQUOTE><A target=_blank>蒋委员长</A> ?<A target=_blank>Eclipse的插件安?/A><BR> <P>众所周知QEclipse无法方便快速的开发SwingE序。因为Eclipse没有自带囑Ş化编码窗口,如果要开发图形化E序Q只有手动敲代码非常不方ѝ现在有一个插件Jigloo提供囑Ş化程序开发窗口,可以xx。如何将它安装到Eclipse当中呢?</P> <P>安装插g一般用Link方式QLink意味链接QEclipse加蝲旉过链接扑ֈ安装的插?BR><A target=_blank><IMG title="引用 Eclipse的插件安?- 紫依?- 见hq是? alt="引用 Eclipse的插件安?- 紫依?- 见hq是? src="http://img.blog.163.com/photo/RoyVqtNFM5UnLdRiuK1rPg==/4829266175424918318.jpg"></A><BR>如上图所C:(x)我的Eclipse路径C:\Program Files\Eclipse 然后Jigloo解压到Eclipse安装目录中?FONT color=#ff0000>q里需要注意Jigloo目录下必要有个叫Eclipse的目录,Eclipse的目录下才是攑օfeatures和plugins目录?/FONT><FONT color=black>以上图ؓ(f)例:(x)C:\Program Files\Eclipse\Jigloo\Eclipse 路径?/FONT><FONT color=#ff0000>攑օfeatures和plugins目录</FONT><FONT color=#000000>Q即features目录路径为:(x)C:\Program Files\Eclipse\Jigloo\Eclipse\featuresQplugins目录路径为:(x)C:\Program Files\Eclipse\Jigloo\Eclipse\plugins  q里必须要强调目录\径,因ؓ(f)我用的是Link方式安装插g?/FONT></P> <P>插g安装位置正确后,p链接?Link)。在Eclipse路径C:\Program Files\Eclipse下徏立一?FONT color=#ff0000>links目录</FONT><FONT color=black>(必须q个名字)Qƈ在links目录下徏立一个Jigloo.link的文?文g名必d插g目录名相同,后缀名必Llink)。最后用C本打开Jigloo.link文gQ填入path = Jigloo(path = 插g目录?。保存后Q重新启动Eclipse。如下图<BR><A target=_blank><IMG title="引用 Eclipse的插件安?- 紫依?- 见hq是? alt="引用 Eclipse的插件安?- 紫依?- 见hq是? src="http://img.blog.163.com/photo/TWURCTTGxyDbJRvuNULfOg==/4525273200577932598.jpg"></A><BR>在新建项目中出现?jin)一个叫GUI Forms的项目,说明插g安装成功Q这是Jigloo插g提供的图形化开发工兗?/FONT></P> <P>写在最后:(x)<BR>向大家推荐一个插件AptanaQ这个插件可以调试Javascript代码和HTML代码。此插gq是W一ƾ支持ajax调试的程序。详?A >http://www.aptana.com/</A>  插g下蝲地址<A >http://update.aptana.com/install/studio/3.2/</A><BR><A target=_blank><IMG title="引用 Eclipse的插件安?- 紫依?- 见hq是? alt="引用 Eclipse的插件安?- 紫依?- 见hq是? src="http://img.blog.163.com/photo/qkrRcOjFtYZGw38ZbJcITw==/606860049788829446.jpg"></A><BR>因ؓ(f)新版本要收费(只有一个月免费试用)Q我使用的老版本,安装到Eclipse中有3个按钮(如上图,黄色惊叹号和U色叉)(j)</P></BLOCKQUOTE></div><br>文章来源:<a >http://wxq594808632.blog.163.com/blog/static/1090797552009384255251</a><img src ="http://www.aygfsteel.com/wxq594808632/aggbug/268126.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/wxq594808632/" target="_blank">武志?/a> 2009-04-08 16:26 <a href="http://www.aygfsteel.com/wxq594808632/archive/2009/04/08/268126.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[导入]ajax兼容IE,FF问题http://www.aygfsteel.com/wxq594808632/archive/2009/03/31/268127.html武志?/dc:creator>武志?/author>Tue, 31 Mar 2009 06:11:00 GMThttp://www.aygfsteel.com/wxq594808632/archive/2009/03/31/268127.htmlhttp://www.aygfsteel.com/wxq594808632/comments/268127.htmlhttp://www.aygfsteel.com/wxq594808632/archive/2009/03/31/268127.html#Feedback0http://www.aygfsteel.com/wxq594808632/comments/commentRss/268127.htmlhttp://www.aygfsteel.com/wxq594808632/services/trackbacks/268127.html

如题Q废话不多说?/P>

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);      //转换Ҏ(gu)字符
     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);     //调用Ҏ(gu)发送Request
   }
   </script>
</head>
<body>
<input type="button" value="提交" onclick="doso()"/>
   </body>
</html>

 

javac?/FONT>

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 {
        //讄字符~码q回的编?BR>        response.setContentType("text/html;charset=UTF-8");
        //接收字符的编?BR>        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);         //q回?/FONT>
        return null;
    }
}

最重要?/FONT>

ajax.js

我用别h的。感谢这位大哥。?/P>

/*
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);//q里可以讄q回cd
   }
  }
   _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);

*/

 

l过本hFFQIE6QIE7Q测试。完全好?/P>
文章来源:http://wxq594808632.blog.163.com/blog/static/109079755200923121054225

]]>
[导入]javadq程url囄,得到宽高http://www.aygfsteel.com/wxq594808632/archive/2009/03/27/268128.html武志?/dc:creator>武志?/author>Fri, 27 Mar 2009 08:05:00 GMThttp://www.aygfsteel.com/wxq594808632/archive/2009/03/27/268128.htmlhttp://www.aygfsteel.com/wxq594808632/comments/268128.htmlhttp://www.aygfsteel.com/wxq594808632/archive/2009/03/27/268128.html#Feedback0http://www.aygfsteel.com/wxq594808632/comments/commentRss/268128.htmlhttp://www.aygfsteel.com/wxq594808632/services/trackbacks/268128.html

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 {
//dq程url囄,得到宽高
    public int[] returnImgWH(String imgurl) {
        boolean b=false;
        try {
            //实例化url
            URL url = new URL(imgurl);
            //载入囄到输入流
            java.io.BufferedInputStream bis = new BufferedInputStream(url.openStream());
            //实例化存储字节数l?BR>            byte[] bytes = new byte[100];
            //讄写入路径以及(qing)囄名称
            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();
            //关闭输出?BR>            b=true;
        } catch (Exception e) {
            //如果囄未找?BR>            b=false;
        }
        int[] a = new int[2];
        if(b){    //囄存在
            //得到文g
            java.io.File file = new java.io.File("C:\\thetempimg.gif");
            BufferedImage bi = null;
            try {
                //d囄
                bi = javax.imageio.ImageIO.read(file);
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            a[0] = bi.getWidth(); //获得 宽度
            a[1] = bi.getHeight(); //获得 高度
            //删除文g
            file.delete();
        }else{     //囄不存?/FONT>
            a=null;
        }
       return a;

    }

    public static void main(String[] args) {
        Img2 i = new Img2();
        int[] a=i.returnImgWH("        if(a==null){
            System.out.println("囄未找?");
        }else{
            System.out.println("宽ؓ(f)" + a[0]);
            System.out.println("高ؓ(f)" + a[1]);
        }
    }
}


文章来源:
http://wxq594808632.blog.163.com/blog/static/10907975520092274458465

]]>
[导入]SQL多条件排?/title><link>http://www.aygfsteel.com/wxq594808632/archive/2009/03/24/268129.html</link><dc:creator>武志?/dc:creator><author>武志?/author><pubDate>Tue, 24 Mar 2009 08:44:00 GMT</pubDate><guid>http://www.aygfsteel.com/wxq594808632/archive/2009/03/24/268129.html</guid><wfw:comment>http://www.aygfsteel.com/wxq594808632/comments/268129.html</wfw:comment><comments>http://www.aygfsteel.com/wxq594808632/archive/2009/03/24/268129.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/wxq594808632/comments/commentRss/268129.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/wxq594808632/services/trackbacks/268129.html</trackback:ping><description><![CDATA[<div><P>如题</P> <P>默认排序方式为asc,可省?..</P> <P>select   *   from   table   order   by   t1   desc,   t2   desc  ,   t3 desc;</P></div><br>文章来源:<a >http://wxq594808632.blog.163.com/blog/static/109079755200922444356457</a><img src ="http://www.aygfsteel.com/wxq594808632/aggbug/268129.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/wxq594808632/" target="_blank">武志?/a> 2009-03-24 16:44 <a href="http://www.aygfsteel.com/wxq594808632/archive/2009/03/24/268129.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[导入]JS的trimҎ(gu)http://www.aygfsteel.com/wxq594808632/archive/2009/03/20/268130.html武志?/dc:creator>武志?/author>Fri, 20 Mar 2009 09:10:00 GMThttp://www.aygfsteel.com/wxq594808632/archive/2009/03/20/268130.htmlhttp://www.aygfsteel.com/wxq594808632/comments/268130.htmlhttp://www.aygfsteel.com/wxq594808632/archive/2009/03/20/268130.html#Feedback0http://www.aygfsteel.com/wxq594808632/comments/commentRss/268130.htmlhttp://www.aygfsteel.com/wxq594808632/services/trackbacks/268130.html

 function jsTrim(value)
       {
              var reg=/^\S$/;
              if (!value) return "";
              if(value.length==0)
                     return value;
              else
              {
                     var lp,rp;
                     lp=0;rp=value.length-1;
                     while ((value.charAt(lp)==" "||(value.charCodeAt(lp)<128?(reg.test(value.charAt(lp))==false?true:false):false)||value.charAt(rp)==" "||(value.charCodeAt(rp)<128?(reg.test(value.charAt(rp))==false?true:false):false))&&rp>=lp)
                     {
                            if (value.charAt(lp)==" "||value.charCodeAt(lp)<128?(reg.test(value.charAt(lp))==false?true:false):false)
                                   lp++;
                            if (value.charAt(rp)==" "||value.charCodeAt(rp)<128?(reg.test(value.charAt(rp))==false?true:false):false)
                                   rp--;
                     }
                     if(lp>rp)
                            return "";
                     else
                            return (value.substring(lp,rp+1));

              }
       }


文章来源:http://wxq594808632.blog.163.com/blog/static/10907975520092205931780

]]>
[导入]Java实现l图片添加水?/title><link>http://www.aygfsteel.com/wxq594808632/archive/2009/03/19/268132.html</link><dc:creator>武志?/dc:creator><author>武志?/author><pubDate>Thu, 19 Mar 2009 05:19:00 GMT</pubDate><guid>http://www.aygfsteel.com/wxq594808632/archive/2009/03/19/268132.html</guid><wfw:comment>http://www.aygfsteel.com/wxq594808632/comments/268132.html</wfw:comment><comments>http://www.aygfsteel.com/wxq594808632/archive/2009/03/19/268132.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/wxq594808632/comments/commentRss/268132.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/wxq594808632/services/trackbacks/268132.html</trackback:ping><description><![CDATA[<div><P> </P> <P><EM>引用</EM></P> <BLOCKQUOTE><A target=_blank>邉|L的空?/A> ?<A target=_blank>Java实现l图片添加水?/A><BR>import java.awt.*;<BR>import java.awt.image.*;<BR>import java.io.*;<BR>import javax.swing.*;<BR>import com.sun.image.codec.jpeg.*; <P>public class WaterMark ...{<BR>/** *//**<BR>* l图片添加水?BR>* @param filePath 需要添加水印的囄的\?BR>* @param markContent 水印的文?BR>* @param markContentColor 水印文字的颜?BR>* @param qualNum 囄质量<BR>* @return<BR>*/<BR>public boolean createMark(String filePath,String markContent,Color markContentColor,float qualNum,String watermark)<BR>...{<BR>ImageIcon imgIcon=new ImageIcon(filePath);<BR>Image theImg =imgIcon.getImage();<BR>int width=theImg.getWidth(null);<BR>int height= theImg.getHeight(null);<BR>//ImageIcon waterIcon=new ImageIcon(watermark);<BR>//Image waterImg =waterIcon.getImage();<BR>BufferedImage bimage = new BufferedImage(width,height, BufferedImage.TYPE_INT_RGB);<BR>Graphics2D g=bimage.createGraphics();<BR>g.setColor(markContentColor);<BR>g.setBackground(Color.white);<BR>g.drawImage(theImg, 0, 0, null );<BR>//g.drawImage(waterImg, width*2, height, null );<BR>g.drawString(markContent,width-100,height-30); //d水印的文字和讄水印文字出现的内?BR>g.dispose();<BR>try...{<BR>FileOutputStream out=new FileOutputStream(filePath);<BR>JPEGImageEncoder encoder =JPEGCodec.createJPEGEncoder(out);<BR>JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bimage);<BR>param.setQuality(qualNum, true);<BR>encoder.encode(bimage, param);<BR>out.close();<BR>}catch(Exception e)<BR>...{ return false; }<BR>return true;<BR>}<BR>public static void main(String arg[])<BR>...{<BR>WaterMark wk=new WaterMark();<BR>if(wk.createMark("D:\1.jpg","Welcome!",Color.WHITE,70f,""))...{<BR>System.out.println("制作成功");<BR>}else...{<BR>System.out.println("p|?jin)?);<BR>}<BR>}<BR>}</P></BLOCKQUOTE></div><br>文章来源:<a >http://wxq594808632.blog.163.com/blog/static/109079755200921911832219</a><img src ="http://www.aygfsteel.com/wxq594808632/aggbug/268132.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/wxq594808632/" target="_blank">武志?/a> 2009-03-19 13:19 <a href="http://www.aygfsteel.com/wxq594808632/archive/2009/03/19/268132.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[导入]如何防止同一个̎戯多个人同时登? http://www.aygfsteel.com/wxq594808632/archive/2009/03/19/268131.html武志?/dc:creator>武志?/author>Thu, 19 Mar 2009 05:19:00 GMThttp://www.aygfsteel.com/wxq594808632/archive/2009/03/19/268131.htmlhttp://www.aygfsteel.com/wxq594808632/comments/268131.htmlhttp://www.aygfsteel.com/wxq594808632/archive/2009/03/19/268131.html#Feedback0http://www.aygfsteel.com/wxq594808632/comments/commentRss/268131.htmlhttp://www.aygfsteel.com/wxq594808632/services/trackbacks/268131.html

 

引用

邉|L的空?/A> ?如何防止同一个̎戯多个人同时登?

1.用session时,session为nullpCZU了(jin)      
     
  2.也可以采用数据库中设|?    临时?    来处?     
  一个用L(fng)陆时向表中插q一条记录,用户d时候删除该记录      
  如想l计在线人数Q简单地执行      
  select     count(*)     from     table...     卛_      
     
  3.application对象中可以记住现在的人数Qapplication的生命周期和服务器的生命周期一样长?     
     
  4.q有一U方法要用到一个文件global.jsa     Q方法是Q在JSP中)(j)是sessionDestroy(),其中它是以session对象为参数的。还有要把global.jsa文g必须房子和JSPE序相同的文件目录内才行?     
     
  5.|页自动h的代码是Q?     
  在文件头部加?     
  <meta     http-equiv="refresh"     content="15">      
  h间隔旉?5U?     
     
     
  6.在session中加入监听类,cȝCZ代码如下:      

onLineUser.java-------------------------------------------------------------------------------------------

package com.shaobo.struts.action;

import javax.servlet.http.*;
import javax.servlet.*;
import java.util.*;

public class onLineUser implements HttpSessionBindingListener {
 public onLineUser() {
 }

 private Vector users = new Vector();

 public int getCount() {
  users.trimToSize();
  return users.capacity();
 }

 public boolean existUser(String userName) {
  users.trimToSize();
  boolean existUser = false;
  for (int i = 0; i < users.capacity(); i++) {
   if (userName.equals((String) users.get(i))) {
    existUser = true;
    break;
   }
  }
  return existUser;
 }

 public boolean deleteUser(String userName) {
  users.trimToSize();
  if (existUser(userName)) {
   int currUserIndex = -1;
   for (int i = 0; i < users.capacity(); i++) {
    if (userName.equals((String) users.get(i))) {
     currUserIndex = i;
     break;
    }
   }
   if (currUserIndex != -1) {
    users.remove(currUserIndex);
    users.trimToSize();
    return true;
   }
  }
  return false;
 }

 public Vector getOnLineUser() {
  return users;
 }

 public void valueBound(HttpSessionBindingEvent e) {
  users.trimToSize();
  if (!existUser(e.getName())) {
   users.add(e.getName());
   System.out.print(e.getName() + "\td到系l\t"
     + (new Date()));
   System.out.println("在线用户Cؓ(f)Q? + getCount());
  } else
   System.out.println(e.getName() + "已经存在");
 }

 public void valueUnbound(HttpSessionBindingEvent e) {
  users.trimToSize();
  String userName = e.getName();
  deleteUser(userName);
  System.out.print(userName + "\t退出系l\t" + (new Date()));
  System.out.println("在线用户Cؓ(f)Q? + getCount());
 }
}

login.jsp--------------------------------------------------------------------------------------------

<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<jsp:useBean id="onlineuser" class="com.shaobo.struts.action.onLineUser"
 scope="application" />
<html>
 <head>
 </head>
 <body onUnload="postMessage()">
  <center>
   <p>
   <h1>
    登陆成功Q欢q访?BR>   </h1>
   </p>
  </center>
  <%
  session = request.getSession(false);
  %>
  <%
   String username = request.getParameter("username");
   if (onlineuser.existUser(username)) {
    out.println("用户<font color=red>" + username
    + "</font>已经登陆Q?);
   } else {
    session.setMaxInactiveInterval(50); //Sesion有效旉Q以Uؓ(f)单位      
    session.setAttribute(username, onlineuser);
    out.println("Ƣ迎新用?<font color=red>" + username
    + "</font>登陆到系l!");
   }
   out.println("<br>当前在线用户人数:<font color=red>"
     + onlineuser.getCount() + "</font><br>");
   String ip = request.getRemoteAddr();
   out.println("<br>IP:<font color=red>" + ip + "</font><br>");
   Vector vt = onlineuser.getOnLineUser();
   Enumeration e = vt.elements();
   out.println("在线用户列表");
   out.println("<table border=1>");
   out.println("<tr><td>用户?lt;/td></tr>");
   while (e.hasMoreElements()) {
    out.println("<tr><td>");
    out.println((String) e.nextElement() + "<br>");
    out.println("</td></tr>");
   }
   out.println("</table>");
  %>
  <center>
   <p>
   </p>
   [
   <a href="javascript:window.close()">关闭H口</a>]
   <%
    out.println("<p><a href='index.jsp'>退出系l?lt;/a></p>");
   %>
  </center>
  <Script>      
              function postMessage(){                                                                  
                 <%onlineuser.deleteUser(request.getParameter("username"));%>      
            }      
  </Script>
 </body>
</html>

Ƣ迎光(f)邉|L的空间` http://blog.sina.com.cn/shaobolive

QQ:343269876


文章来源:http://wxq594808632.blog.163.com/blog/static/10907975520092191192874

]]>
[导入]java文g操作2http://www.aygfsteel.com/wxq594808632/archive/2009/03/19/268133.html武志?/dc:creator>武志?/author>Thu, 19 Mar 2009 05:18:00 GMThttp://www.aygfsteel.com/wxq594808632/archive/2009/03/19/268133.htmlhttp://www.aygfsteel.com/wxq594808632/comments/268133.htmlhttp://www.aygfsteel.com/wxq594808632/archive/2009/03/19/268133.html#Feedback0http://www.aygfsteel.com/wxq594808632/comments/commentRss/268133.htmlhttp://www.aygfsteel.com/wxq594808632/services/trackbacks/268133.html一.获得控制台用戯入的信息

/** *//**获得控制台用戯入的信息
     * @return
     * @throws IOException
     */
    public String getInputMessage() throws IOException...{
        System.out.println("误入?zhn)的命令?);
        byte buffer[]=new byte[1024];
        int count=System.in.read(buffer);
        char[] ch=new char[count-2];//最后两位ؓ(f)l束W,删去不要
        for(int i=0;i<count-2;i++)
            ch[i]=(char)buffer[i];
        String str=new String(ch);
        return str;
    }
可以q回用户输入的信息,不之处在于不支持中文输入,有待q一步改q?

?复制文g

1.以文件流的方式复制文?

/** *//**以文件流的方式复制文?
     * @param src 文g源目?
     * @param dest 文g目的目录
     * @throws IOException 
     */
    public void copyFile(String src,String dest) throws IOException...{
        FileInputStream in=new FileInputStream(src);
        File file=new File(dest);
        if(!file.exists())
            file.createNewFile();
        FileOutputStream out=new FileOutputStream(file);
        int c;
        byte buffer[]=new byte[1024];
        while((c=in.read(buffer))!=-1)...{
            for(int i=0;i<c;i++)
                out.write(buffer[i]);       
        }
        in.close();
        out.close();
    }
该方法经q测试,支持中文处理Qƈ且可以复制多U类型,比如txtQxmlQjpgQdoc{多U格?

?写文?

1.利用PrintStream写文?

/** *//**
     * 文g输出CZ
     */
    public void PrintStreamDemo()...{
        try ...{
            FileOutputStream out=new FileOutputStream("D:/test.txt");
            PrintStream p=new PrintStream(out);
            for(int i=0;i<10;i++)
                p.println("This is "+i+" line");
        } catch (FileNotFoundException e) ...{
            e.printStackTrace();
        }
    }
2.利用StringBuffer写文?

public void StringBufferDemo() throws IOException......{
        File file=new File("/root/sms.log");
        if(!file.exists())
            file.createNewFile();
        FileOutputStream out=new FileOutputStream(file,true);       
        for(int i=0;i<10000;i++)......{
            StringBuffer sb=new StringBuffer();
            sb.append("q是W?+i+"?前面介绍的各U方法都不关?Z么L奇怪的问题 ");
            out.write(sb.toString().getBytes("utf-8"));
        }       
        out.close();
    }
该方法可以设定用何U编码,有效解决中文问题?

?文g重命?


    /** *//**文g重命?
     * @param path 文g目录
     * @param oldname  原来的文件名
     * @param newname 新文件名
     */
    public void renameFile(String path,String oldname,String newname)...{
        if(!oldname.equals(newname))...{//新的文g名和以前文g名不同时,才有必要q行重命?
            File oldfile=new File(path+"/"+oldname);
            File newfile=new File(path+"/"+newname);
            if(newfile.exists())//若在该目录下已经有一个文件和新文件名相同Q则不允?dng)R命名
                System.out.println(newname+"已经存在Q?);
            else...{
                oldfile.renameTo(newfile);
            }
        }        
    }?转移文g目录


转移文g目录不等同于复制文gQ复制文件是复制后两个目录都存在该文Ӟ而{UL件目录则是{UdQ只有新目录中存在该文g?

    /** *//**转移文g目录
     * @param filename 文g?
     * @param oldpath 旧目?
     * @param newpath 新目?
     * @param cover 若新目录下存在和转移文gh相同文g名的文gӞ是否覆盖新目录下文gQcover=true会(x)覆盖原文Ӟ否则不操?
     */
    public void changeDirectory(String filename,String oldpath,String newpath,boolean cover)...{
        if(!oldpath.equals(newpath))...{
            File oldfile=new File(oldpath+"/"+filename);
            File newfile=new File(newpath+"/"+filename);
            if(newfile.exists())...{//若在待{Uȝ录下Q已l存在待转移文g
                if(cover)//覆盖
                    oldfile.renameTo(newfile);
                else
                    System.out.println("在新目录下已l存在:(x)"+filename);
            }
            else...{
                oldfile.renameTo(newfile);
            }
        }      
    }



?L?

1.利用FileInputStreamd文g


    /** *//**L?
     * @param path
     * @return
     * @throws IOException
     */
    public String FileInputStreamDemo(String path) throws IOException...{
        File file=new File(path);
        if(!file.exists()||file.isDirectory())
            throw new FileNotFoundException();
        FileInputStream fis=new FileInputStream(file);
        byte[] buf = new byte[1024];
        StringBuffer sb=new StringBuffer();
        while((fis.read(buf))!=-1)...{
            sb.append(new String(buf));   
            buf=new byte[1024];//重新生成Q避免和上次d的数据重?
        }
        return sb.toString();
    }


2.利用BufferedReaderd

在IO操作Q利用BufferedReader和BufferedWriter效率?x)更高一?

    /** *//**L?
     * @param path
     * @return
     * @throws IOException
     */
    public String BufferedReaderDemo(String path) throws IOException...{
        File file=new File(path);
        if(!file.exists()||file.isDirectory())
            throw new FileNotFoundException();
        BufferedReader br=new BufferedReader(new FileReader(file));
        String temp=null;
        StringBuffer sb=new StringBuffer();
        temp=br.readLine();
        while(temp!=null)...{
            sb.append(temp+" ");
            temp=br.readLine();
        }
        return sb.toString();
    }


3.利用dom4jdxml文g

    /** *//**从目录中dxml文g
     * @param path 文g目录
     * @return
     * @throws DocumentException
     * @throws IOException
     */
    public Document readXml(String path) throws DocumentException, IOException...{
        File file=new File(path);
        BufferedReader bufferedreader = new BufferedReader(new FileReader(file));
        SAXReader saxreader = new SAXReader();
        Document document = (Document)saxreader.read(bufferedreader);
        bufferedreader.close();
        return document;
    }


?创徏文g(文g?

1.创徏文g?nbsp; /** *//**创徏文g?
     * @param path  目录
     */
    public void createDir(String path)...{
        File dir=new File(path);
        if(!dir.exists())
            dir.mkdir();
    }
2.创徏新文?/** *//**创徏新文?
     * @param path 目录
     * @param filename 文g?
     * @throws IOException
     */
    public void createFile(String path,String filename) throws IOException...{
        File file=new File(path+"/"+filename);
        if(!file.exists())
            file.createNewFile();
    }
?删除文g(目录)

1.删除文g     /** *//**删除文g
     * @param path 目录
     * @param filename 文g?
     */
    public void delFile(String path,String filename)...{
        File file=new File(path+"/"+filename);
        if(file.exists()&&file.isFile())
            file.delete();
    }
2.删除目录
要利用Filecȝdelete()Ҏ(gu)删除目录Ӟ必须保证该目录下没有文g或者子目录Q否则删除失败,因此在实际应用中Q我们要删除目录Q必d用递归删除该目录下的所有子目录和文Ӟ然后再删除该目录?nbsp; /** *//**递归删除文g?
     * @param path
     */
    public void delDir(String path)...{
        File dir=new File(path);
        if(dir.exists())...{
            File[] tmp=dir.listFiles();
            for(int i=0;i<tmp.length;i++)...{
                if(tmp[i].isDirectory())...{
                    delDir(path+"/"+tmp[i].getName());
                }
                else...{
                    tmp[i].delete();
                }
            }
            dir.delete();
        }
    }
文章来源:http://wxq594808632.blog.163.com/blog/static/109079755200921911749952

]]>
վ֩ģ壺 | | С| | | | | | | żҿ| ɽ| ɽ| ָ| ƽ| ͼƬ| ¹| ƽԶ| ɽ| ͳ| | ƽ| | ϼ| | ʶ| | °| ¡| ͭ| | | ֲ| | ̩| | Ѯ| | | | | ԭ|