??xml version="1.0" encoding="utf-8" standalone="yes"?>麻豆精品在线,国产亚洲一二三区,成人精品网站在线观看http://www.aygfsteel.com/Jcat/category/11843.html宠i不惊Q闲看庭前花开p~~zh-cnMon, 07 Jan 2013 04:39:20 GMTMon, 07 Jan 2013 04:39:20 GMT60Groovy 修饰W?/title><link>http://www.aygfsteel.com/Jcat/archive/2008/11/10/239638.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Mon, 10 Nov 2008 04:30:00 GMT</pubDate><guid>http://www.aygfsteel.com/Jcat/archive/2008/11/10/239638.html</guid><wfw:comment>http://www.aygfsteel.com/Jcat/comments/239638.html</wfw:comment><comments>http://www.aygfsteel.com/Jcat/archive/2008/11/10/239638.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/Jcat/comments/commentRss/239638.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/Jcat/services/trackbacks/239638.html</trackback:ping><description><![CDATA[Groovy<font color="#0000ff">把最常用的东襉K讄成default</font>了,l常可以省这省那的(比如括号、分受public{)Q又加上闭包Q初学的时候,有些代码Q一眼望去,都分不清是方法、是cR还是闭包?br />q里先简单ȝ一下常用的修饰W?br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">package</span><span style="COLOR: #000000"> jcat.bit.g<br /><br /></span><span style="COLOR: #008000">/*</span><span style="COLOR: #008000"><br />修饰W有三类Q?br />1. static<br />2. 作用域:(x)public(默认), private, protected.<br />3. cdQdefQ默认,动态), voidQ无cdQ静态), 其它常规静态类?br /></span><span style="COLOR: #008000">*/</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> Test {<br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> def a_static_def </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">a_static_def</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000"><br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> a_static </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">a_static</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000"><br />    def a_def </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">a_def</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000"><br /><br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> main(strs) {<br />        println a_static_def<br />        println a_static<br /><br />        println t_static_def()<br />        println t_static()<br /><br /><br />        </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Test().with {<br />            println a_def<br /><br />            println t_public_def()<br />            println t_public()<br />            println t_def()<br />        }<br />    }<br /><br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> def t_static_def() { </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> def = 可以q回McdQ包括void</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">t_static_def</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br />    }<br /><br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> t_static() { </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 有其它修饰符可以省略defQ?font color="#ff0000">默认public + def</font>Q?/span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">t_static</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br />    }<br /><br />    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> def t_public_def() {<br />        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">t_public_def</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br />    }<br /><br />    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> t_public() { </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 默认def</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">t_public</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br />    }<br /><br />    def t_def() { </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 臛_要有一个修饰符Q所以这个def不能省略; 且默认public</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">t_def</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br />    }<br /><br />    </span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> t_static_void() {<br />        </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">return "t_static_void"    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> cannot return an object from a method that returns "void"</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">    }<br />}</span></div><img src ="http://www.aygfsteel.com/Jcat/aggbug/239638.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/Jcat/" target="_blank">Jcat</a> 2008-11-10 12:30 <a href="http://www.aygfsteel.com/Jcat/archive/2008/11/10/239638.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Groovy JDBChttp://www.aygfsteel.com/Jcat/archive/2008/11/07/239258.htmlJcatJcatFri, 07 Nov 2008 07:02:00 GMThttp://www.aygfsteel.com/Jcat/archive/2008/11/07/239258.htmlhttp://www.aygfsteel.com/Jcat/comments/239258.htmlhttp://www.aygfsteel.com/Jcat/archive/2008/11/07/239258.html#Feedback3http://www.aygfsteel.com/Jcat/comments/commentRss/239258.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/239258.html用JDBC操作数据库,Ҏ(gu)一下Java和Groovy?br />
环境QSQL Server 2000 Q记得打补丁SP4Q不然JDBC讉K?x)报错?br />JDBC DriverQmsbase.jarQmssqlserver.jarQmsutil.jar

Java?br />

package  jcat.bit.java;

import  java.sql. * ;

public   class  JDBC {
    
public   static   void  main(String[] args)  throws  ClassNotFoundException, SQLException {
        Class.forName(
" com.microsoft.jdbc.sqlserver.SQLServerDriver " );
        Connection conn 
=  DriverManager.getConnection(
                
" jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs " ,
                
" sa " "*** " );

        Statement stmt 
=  conn.createStatement();
        ResultSet rs 
=  stmt.executeQuery( " select top 10 * from authors " );

        
while  (rs.next()) {
            System.out.println(rs.getString(
2 ) + "   " + rs.getString( 3
));  // 数id
        }


        rs.close();
        stmt.close();
        conn.close();

    }
}



Groovy?br />
package jcat.bit.groovy

import groovy.sql.Sql

class JDBC {
    
static void main(args) {
        Sql sql 
= Sql.newInstance(
                
"jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs",
                
"sa""***",
                
"com.microsoft.jdbc.sqlserver.SQLServerDriver")
        sql.eachRow(
"select top 10 * from authors") {row ->
            println row.au_fname 
+ " " + row.au_lname    //直接用数据库的字D名可以操作结果集了,不用Lid
        }

    }
}


ȝ
1. 建立查询Q差别不大,都是JDBC那一套;Groovy不用处理异常
2. 处理查询l果QGroovy因ؓ(f)有闭包,处理q些q代问题很方?/font>
3. Groovy不用关闭

Jcat 2008-11-07 15:02 发表评论
]]>
Groovy Closure “操作”也成了参数http://www.aygfsteel.com/Jcat/archive/2008/11/07/239142.htmlJcatJcatThu, 06 Nov 2008 18:04:00 GMThttp://www.aygfsteel.com/Jcat/archive/2008/11/07/239142.htmlhttp://www.aygfsteel.com/Jcat/comments/239142.htmlhttp://www.aygfsteel.com/Jcat/archive/2008/11/07/239142.html#Feedback2http://www.aygfsteel.com/Jcat/comments/commentRss/239142.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/239142.html

1. 闭包代表Q定义)了一D代码(操作Q:(x)光看q一句,其实Ҏ(gu)也能实现相同的功能呀?br />2. 闭包可以作ؓ(f)Ҏ(gu)的参敎ͼ(x)q才是闭包的Ҏ(gu)之处和真正意义?br />

下面演示一个只有闭包能做,Ҏ(gu)做不到的例子?br />

Ҏ(gu)的作用是提炼共性,再代之以不同的参数。即对不同的“数据”进行相同的“操作”。从3个loop可以看出Q?br />    Comm1Q相同的数据
    Comm2Q相同的for循环
    Diff1Q@环体内执行的操作不同

Comm1很好搞定Q参数aa是提炼出的共?br />Comm2看似是共性,却很难提|因ؓ(f)for循环和@环体内的操作实际是一个整体;Comm2被Diff1U缠Q?个loop是完全不同的3l操作,无法提炼?br />
比如Q如果现在想要按照奇数@环,只能依次改动三个循环?/font> 

int [] aa  =  [ 1 2 3 4 5 6 ]

//  loop1
for  ( int  i  =   0 ; i  <  aa.length; i ++ ) {
    println aa[i]
}

//  loop2
for  ( int  i  =   0 ; i  <  aa.length; i ++ ) {
    print aa[i]
}

//  loop3
for  ( int  i  =   0 ; i  <  aa.length; i ++ ) {
    print aa[i] 
+   '   '
}
        

//  loop1
for  ( int  i  =   0 ; i  <  aa.length;  +=   2 ) {
    println aa[i]
}

//  loop2
for  ( int  i  =   0 ; i  <  aa.length;  +=   2 ) {
    print aa[i]
}

//  loop3
for  ( int  i  =   0 ; i  <  aa.length;  +=   2 ) {
    print aa[i] 
+   '   '
}


下面我们看看闭包的强大之处,Comm1和Comm2都被很好的封装在了loopҎ(gu)里;Diff1则作为参敎ͼ闭包Q传入loopҎ(gu)?br />
static void main(String[] a) {
    
int[] aa = [123456]

    loop(aa) { println it }
    loop(aa) { print it }   
    loop(aa) { print it 
+ ' ' }
}
如果我们惌改变循环的方式,只需要改一?
static void loop(int[] aa, Closure c) {
    
for (int i = 0; i < aa.length; i++) {
        c.call(aa[i])
    }
    println 
' '
}
static void loop(int[] aa, Closure c) {
    
for (int i = 0; i < aa.length; += 2) {
        c.call(aa[i])
    }
    println 
' '
}

ȝQ闭包本wƈ没什么难点,关键是怎样合理的设计一个接受Closurecd参数的方法。从GDK的方法也可以看出Q大多数接受闭包的方法都是和数组q代有关Q也卛_@环)?/font>

Jcat 2008-11-07 02:04 发表评论
]]>
Groovy Closurehttp://www.aygfsteel.com/Jcat/archive/2008/11/06/239095.htmlJcatJcatThu, 06 Nov 2008 10:50:00 GMThttp://www.aygfsteel.com/Jcat/archive/2008/11/06/239095.htmlhttp://www.aygfsteel.com/Jcat/comments/239095.htmlhttp://www.aygfsteel.com/Jcat/archive/2008/11/06/239095.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/239095.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/239095.htmlDefinition

    /*
        1. 变量是用来装“数据”的Q闭包就是用来装“操作”的
        2. 和定义一个方法一P闭包也可以有入参
       
*/
        Closure p 
=  {x  ->
            print x 
+   '   '
        }
        [
1 2 3 ].each(p)

        [
4 5 6 ].each({x  ->   //  闭包是可以匿名的
            print x  +   '   '
        })

        [
7 8 9 ].each {x  ->   //  括号是可以省略的
            print x  +   '   '
        }

        [
10 11 12 ].each {  //  it是默认的参数名字Q所以这里连入参的定义都省了
            print it  +   '   '
        }


Using

package jcat.bit

class Test {
    
/*
    1. 闭包是对象,是Closurecȝ实例Q所以:(x)
        1Q可以在c里定义Closurecd的属?br />        2Q可以在Ҏ(gu)里定义Closurecd的变?br />        3Q可以定义一个方法,接收Closurecd的参?br />    2. 闭包又有Ҏ(gu)特质Q毕竟它装的是“操作”,甚至可以像调用方法一栯用闭?br />     
*/

    
static final Closure PRINT_STR = {  // 属性(cd量)
        println it
    }


    
static void main(String[] a) {
        
/*
        闭包cMJava的内部类Q区别是闭包只有单一的方法可以调用,但可以有L的参敎ͼ
        闭包用“{}”括P?>”前面是参数Q后面是处理语句Q可以直接调用,也可以
        用call调用。不那U调用,最后groovy~译器都?x)把~译成对doCallҎ(gu)的调用,
        q是groovy寚w包的一个隐藏方法?br />         
*/
        PRINT_STR(
"像方法一栯?/span>")
        PRINT_STR.call(
"作ؓ(f)Closure的实例,再调用相应的Ҏ(gu)")


        Closure printLength 
= {String s ->  // 局部变?/span>
            println s.length()
        }
        printLength(
"AAA")

        
/*
        通常Q操作是ȝQ我们能动态代入的是“数据”?br />        闭包使得我们可以动态的代入一D“操作”?br />        “闭包是可以用作Ҏ(gu)参数的代码块。?br />         
*/
        closureAsParameter(
null, printLength)
        closureAsParameter(
"BBB", PRINT_STR)
    }

    
static void closureAsParameter(String s, Closure c) {
        
if (s != null) {
            c.call(s)
        }
    }
}



-----------------------------------------------------------------
附上一个Java的匿名内部类的例子,用来和闭包对比一下?br />
package jcat.bit;

public class AnonymousInnerClass {
    
public static void main(String[] args) {
        AbsClass a 
= new AbsClass() {
            
public void foo(String s) {
                System.out.println(s);
            }
        };

        a.foo(
"ABC");

        AbsClass b 
= new AbsClass() {
            
public void foo(String s) {
                System.out.println(s.length());
            }
        };
        b.foo(
"ABC");
    }
}

abstract class AbsClass {
    
public abstract void foo(String s);
}


Jcat 2008-11-06 18:50 发表评论
]]>
Hello Grailshttp://www.aygfsteel.com/Jcat/archive/2008/11/04/238710.htmlJcatJcatTue, 04 Nov 2008 14:04:00 GMThttp://www.aygfsteel.com/Jcat/archive/2008/11/04/238710.htmlhttp://www.aygfsteel.com/Jcat/comments/238710.htmlhttp://www.aygfsteel.com/Jcat/archive/2008/11/04/238710.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/238710.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/238710.html
1. <Flex 3> 同事l了我䆾Flex的教E,把前三章看了一下,有了初步的了解;FlexBuilder也用了一把,不错Q效果很l丽?br />
2. <IDEA 8> 恰逢IDEA 8 EAP (Early Access Preview)发布Q搞了一个装上试试。主要试了试对Flex的支持,感觉q有待提升。另外IDEA对内存的消耗似乎越来越多了Q没做深入体验?br />
3. <Grails 1.0.3> 拿出了小二去q送我的生日礼物《Grails权威指南》,M,Hello World一?x)就做好了。打再q一步体验一下?br />

Jcat 2008-11-04 22:04 发表评论
]]>
java foundationhttp://www.aygfsteel.com/Jcat/archive/2007/05/23/119499.htmlJcatJcatWed, 23 May 2007 14:35:00 GMThttp://www.aygfsteel.com/Jcat/archive/2007/05/23/119499.htmlhttp://www.aygfsteel.com/Jcat/comments/119499.htmlhttp://www.aygfsteel.com/Jcat/archive/2007/05/23/119499.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/119499.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/119499.html
equals in String
public boolean equals(Object anObject) {
    
if (this == anObject) {
        
return true;
    }
    
if (anObject instanceof String) {
        String anotherString 
= (String)anObject;
        
int n = count;
        
if (n == anotherString.count) {
        
char v1[] = value;
        
char v2[] = anotherString.value;
        
int i = offset;
        
int j = anotherString.offset;
        
while (n-- != 0) {
            
if (v1[i++!= v2[j++])
            
return false;
        }
        
return true;
        }
    }
    
return false;
    }

equals in Object
   public boolean equals(Object obj) {
    
return (this == obj);
    }

    System.out.println(new String("aa").equals(new String("aa"))); //true
    System.out.println(new String("aa"== new String("aa"));      //false
    System.out.println("aa".equals("aa"));                         //true
    System.out.println("aa" == "aa");                              //true



Jcat 2007-05-23 22:35 发表评论
]]>
environment variable for java, groovy, ant and etc.http://www.aygfsteel.com/Jcat/archive/2007/05/23/119491.htmlJcatJcatWed, 23 May 2007 13:39:00 GMThttp://www.aygfsteel.com/Jcat/archive/2007/05/23/119491.htmlhttp://www.aygfsteel.com/Jcat/comments/119491.htmlhttp://www.aygfsteel.com/Jcat/archive/2007/05/23/119491.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/119491.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/119491.htmlJAVA_HOME


ANT_HOME

CATALINA_HOME

GROOVY_HOME

GRAILS_HOME

classpath=.
(%JAVA_HOME%\jre\lib is not required)


Path=%JAVA_HOME%\bin;%ANT_HOME%\bin;%CATALINA_HOME%\bin;%GROOVY_HOME%\bin;%GRAILS_HOME%\bin


Note: if you add %GROOVY_HOME%\embeddable\groovy-all-1.0.jar to classpath Grails can't work correctly.

Jcat 2007-05-23 21:39 发表评论
]]>Strutshttp://www.aygfsteel.com/Jcat/archive/2007/04/08/109284.htmlJcatJcatSun, 08 Apr 2007 15:47:00 GMThttp://www.aygfsteel.com/Jcat/archive/2007/04/08/109284.htmlhttp://www.aygfsteel.com/Jcat/comments/109284.htmlhttp://www.aygfsteel.com/Jcat/archive/2007/04/08/109284.html#Feedback1http://www.aygfsteel.com/Jcat/comments/commentRss/109284.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/109284.htmlstruts用了也一q了Q基本的东西都会(x)用,不过因ؓ(f)是在工作中边学边用,隑օ很多知识炚w不系l,惭愧呀。这几天找本书梳理一下?/span>

---MVC---
VQ多U视囑օ享一个后台模?br>MQ实C界面独立Q良好的装
CQ更好的l护E序程

model1QJSPQV、CQ?JavaBeanQMQ?br>只适用于小型程序,JSP的双重角色HTML和Java混合Q很隄护?br>
model2QJSP(V)+Servlet(C)+JavaBean(M)
Struts也是model2Q用ActionServlet代替ServletQ。Struts的所有功能都是徏立在已有的Java Weblg上,如ServletQJSPQJavaBeanQ它只是利用一U方式将q些元素l织了v来,使它们协同工作?br>
---Ҏ(gu)---
在Struts应用E序中,所有的用户h都由ActionServlet接收Q然后根据struts-config.xml查找相应的子控制器。Web容器加蝲Struts应用E序后,struts-config.xml被首先读入内存成Z个ActionMapping对象?br>
基本程QHttpRequest-->XxxForm-->validate()=true-->XxxAction-->execute()-->(return) ActionForward-->JSP
q其中的配置信息都存在于struts-config?br>
国际化:(x)<bean:message key=""/> + ApplicationResources.properties

---web.xml---
<display-name>    ApplicationContext name
<listener>   配置事g监听?br><session-config> -->  <session-timeout>    Sessionq期旉
<welcome-file-list>   根URL的默认页面:(x)先找index文gQ找不到再查找该list
<error-page>     制定在返回特定HTTP状态码Q或者特定类型的异常被抛出时昄的页面?br><taglib>    Ҏ(gu)记库描述W文ӞTag Library Descriptor FileQ指定别?br>
---struts-config.xml---
<data-source>   定义数据?br><global-exceptions>   定义全局异常
<global-forwards>      定义全局转发Q名字相同时Q局部{发优先)
<controller>      定义控制配置c,如TilesRequestProcessor
<message-resources>   指定消息资源文gQ配?lt;bean:message key="" bundle="">使用
<plug-in>      插g

---Action?--
ActionQ线E安全的Q所以都是singlon的。不应该在ActioncM使用域变量保存用L(fng)定信息,如状态信息(可以一些与特定h无关的变量定义ؓ(f)域变量,如Log变量Q?br>ActionForwardQ可以是静态的从config文g中读Q如mapping.findForward("success")Q也可以是动态的指定Q如new ActionForward("success","/aaa/bbb.jsp",true)

预定义的Action
 ForwardActionQ类?lt;jsp:forward>
 IncludeActionQ类?lt;jsp:include>
  以上两个ActionQStruts遵@MVCQ避免直接调用JSPQ可以充分利用控制器的预处理功能?nbsp;
 DispatchActionQ以资源Z心,减少Action的数量?br>  通常可设|parameter="method"Q则调用的url为http://xxx/yyy?method=add
  也可以设|parameter="add, update"Q则调用的url为http://xxx/yyy?add=true
 LookupDispatchActionQDispatchAction的子c,通过反查资源l定Q找到类中对应的Ҏ(gu)?br> SwitchActionQStruts支持多应用程序模块(即multi-moduleQ,SwitchAction用来执行在不同应用程序模块间的切换操作?br>


Jcat 2007-04-08 23:47 发表评论
]]>
Apache vs Tomcathttp://www.aygfsteel.com/Jcat/archive/2007/03/06/102262.htmlJcatJcatTue, 06 Mar 2007 13:00:00 GMThttp://www.aygfsteel.com/Jcat/archive/2007/03/06/102262.htmlhttp://www.aygfsteel.com/Jcat/comments/102262.htmlhttp://www.aygfsteel.com/Jcat/archive/2007/03/06/102262.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/102262.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/102262.html本质区别Q?br />1Q?br />apache支持静态页面;
tomcat支持动态页面,比如servlet{?br />2Q?br />apache是webQhttpQ服务器Q它是专门用于提供HTTP服务Q以及相关配|的Q例如虚拟主机、URL转发{等Q?br />tomcat是应用(javaQ服务器Q它只是一个servletQjspQ容器,可以认ؓ(f)是apache的扩展,但是可以独立于apacheq行?br />3Q?br />apache是一辆卡车,上面可以装一些东西如html{。但是不能装_(d)要装水必要有容器(ӞQ而这个桶也可以不攑֜卡R上?br />
使用区别Q?br />tomcat 作ؓ(f) jspQservlet 容器Q虽然有静态解析功能,但性能上与 apache 相比相差很远?br />apache 可以q行一q不重启Q稳定性非常好Q?tomcat 则不见得?br />
整合Q?br />一般用apache+tomcat的话Qapache只是作ؓ(f)一个{发,对jsp的处理是由tomcat来处理的?br />
整合的好处是Q?br />如果客户端请求的是静态页面,则只需要Apache服务器响应请求,apache 解析 html {静态网非常快Q是l过无数试证明的?br />如果客户端请求动态页面,则是Tomcat服务器响应请求?br />因ؓ(f)jsp是服务器端解释代码的Q这h合就可以减少Tomcat的服务开销?

其它Q?br />Tomcat是Apachel织在符合J2EE的JSP、Servlet标准下开发的一个JSP服务?br />

some official definitions:
What is the Apache HTTP Server?
    * is a powerful, flexible, HTTP/1.1 compliant web server
    * implements the latest protocols, including HTTP/1.1 (RFC2616)
    * is highly configurable and extensible with third-party modules
    * can be customised by writing 'modules' using the Apache module API
    * provides full source code and comes with an unrestrictive license
    * runs on Windows 2003/XP/2000/NT/9x, Netware 5.x and above, OS/2, and most versions of Unix, as well as several other operating systems

What is the Apache Tomcat?
    Apache Tomcat is the servlet container that is used in the official Reference Implementation for the Java Servlet and JavaServer Pages technologies. The Java Servlet and JavaServer Pages specifications are developed by Sun under the Java Community Process.
    Apache Tomcat is developed in an open and participatory environment and released under the Apache Software License.


Jcat 2007-03-06 21:00 发表评论
]]>
input data from cmdhttp://www.aygfsteel.com/Jcat/archive/2007/02/04/97871.htmlJcatJcatSun, 04 Feb 2007 11:24:00 GMThttp://www.aygfsteel.com/Jcat/archive/2007/02/04/97871.htmlhttp://www.aygfsteel.com/Jcat/comments/97871.htmlhttp://www.aygfsteel.com/Jcat/archive/2007/02/04/97871.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/97871.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/97871.html import  java.io.InputStreamReader;
import  java.io.BufferedReader;
import  java.io.IOException;

/**
 * User: Jcat
 * Date: 2006-11-19
 
*/
public   class  Lab {
    
public   static   void  main(String[] args)  throws  IOException {
        InputStreamReader ir;
        BufferedReader in;
        String s;

        ir 
=   new  InputStreamReader(System.in);
        in 
=   new  BufferedReader(ir);
        s 
=  in.readLine();
        System.out.println(s);
    }
}



Jcat 2007-02-04 19:24 发表评论
]]>
The ultimate webdesign usability checklisthttp://www.aygfsteel.com/Jcat/archive/2007/01/25/95893.htmlJcatJcatThu, 25 Jan 2007 04:39:00 GMThttp://www.aygfsteel.com/Jcat/archive/2007/01/25/95893.htmlhttp://www.aygfsteel.com/Jcat/comments/95893.htmlhttp://www.aygfsteel.com/Jcat/archive/2007/01/25/95893.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/95893.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/95893.html

I noticed that I, and fellow webdesigners, keep making the same usability mistakes over and over. This checklist with 88 questions is a must read for every webdesigner who cares about usability.

This website, NotUsable.com, is not designed by me. Giving me the perfect excuse why this website doesn’t pass my own usability checklist. :) But I would love to hear your comments and don’t forget to let me know when you can answer the whole checklist with ‘yes?

Note that my design company is called Achtentachtig, which means Eighty Eight in Dutch, that’s why there are 88 questions in this checklist. Just to let you know.

Enough talking, let’s start!

    Technical

  1. Did you validate your (X)HTML using W3C Markup Validation Service?
  2. Did you validate your CSS using W3C CSS Validation Service?
  3. Did you check your website in at least IE, FF, Opera and Safari?
  4. Images

  5. Did you add the ALT and TITLE attributes to all your important images?
  6. Did you add the LONGDESC attributes to all your image that need a description?
  7. Did you write effective ALT text?
  8. Did you make the size of your pages less then 50KB?
  9. Did you choose the appropriate filetype for your images?
  10. Did you add a description to images that support your content?
  11. Did you use plain text instead of images for important content?
  12. Content

  13. Did you use a sans-serif typeface with a decent font size for your body text?
  14. Did you adjusted the leading and tracking, if necessary, to increase readability?
  15. Did you align your body text to the left? (depends on language)
  16. Did you use EM or percentages instead of PX?
  17. Did you make sure that there are no whole sentences in uppercase?
  18. Did you use less then 78 characters, including spaces, per line?
  19. Did you make brief and precise paragraphs with explanatory titles?
  20. Did you use lists to sum things up?
  21. Did you write your conclusion first and then your explanation?
  22. Did you create enough contrast between the text and the background?
  23. Did you make your website also accessible for text-only browsers?
  24. Did you make sure that there are no ‘under construction?pages?
  25. Did you include a print function on pages with a large amount of text?
  26. Did you include a print stylesheet?
  27. Did you replace all special characters with the ISO Latin-1 codes?
  28. Did you spell check your content and did you proofread for grammar errors??
  29. Navigation

  30. Did you make sure that all your links work? W3C Link checker does the job.
  31. Did you include a link to all your main pages on your homepage?
  32. Did you include your main navigation on every page?
  33. Did you use no more then 8 items in your main navigation?
  34. Did you distinguish the active and nonactive page in the menu?
  35. Did you use self explanatory link text instead of ‘click here?
  36. Did you use self explanatory link text instead of business terms?
  37. Did you make a distinction between visited and non-visited links?
  38. Did you make a distinction between links and plain text?
  39. Did you add the TITLE attribute to all your links?
  40. Did you use breadcrumbs if you have a large amount of pages?
  41. Did you include a search option if you have a large amount of pages?
  42. Did you make your logo link to your homepage?
  43. Did you make a skip to content link at the top of your pages?
  44. Did you make a skip to menu link at the top of your pages?
  45. Did you make it possible to browse your website using SHIFT-TAB and RETURN?
  46. Did you make sure you didn’t use any javascript links?
  47. Structure

  48. Did you make a consistent page structure?
  49. Did you place your logo at the top left?
  50. Did you place an explanatory tag line next to your logo?
  51. Did you place your search box at the top right?
  52. Did you place important content above the fold/scroll?
  53. Did you make your design on a grid system?
  54. Did you make your design fluid using percentages?
  55. Did you make your website also viewable on low resolutions?
  56. Did you make custom titles (as in TITLE tag) for all your pages?
  57. Forms

  58. Did you make sure that users don’t return to an altered form after an error?
  59. Did you make a friendly and informative error page?
  60. Did you make a friendly ‘thank you?page with a confirmation email?
  61. Did you add only a ’submit?button and no ‘reset?button?
  62. Did you tell the user what to expect after clicking the submit button?
  63. Did you split long forms up into multiply pages?
  64. Did you gave the user room to type?
  65. Did you place an asterisk when a field is compulsatory?
  66. Did you keep the standard look of input fields that is generated by the browser?
  67. Did you create a logical order of asking information?
  68. Did you use double input fields for passwords only?
  69. Did you let the computer, not the user, handle information formatting?
  70. Did you make sure that users can fill in the entire form using the TAB key?
  71. Did you explain to the user why you ask certain information?
  72. Did you explain to the user what you are going to do with that information?
  73. Did you use realtime validation using AJAX?
  74. Did you use the LABEL tag?
  75. Did you place the LABEL above the input field, instead of next to it?
  76. Did you choose the correct input type for different data?
  77. Did you make the top input field automatically active using setfocus?
  78. Did you destinguish the active field from non-active fields using input:focus?
  79. Did you use the FIELDSET and LEGEND entities when appropriate?
  80. Did you check if your forms also work with Javascript turned off?
  81. Multimedia

  82. Did you make sure that essential information/navigation is not made in Flash?
  83. Did you make sure that music and videoclips don’t start playing automatically?
  84. Did you make sure that music and videoclips can be turned off at any time?
  85. Did you inform the user about the size and length of your music and videoclips?
  86. Extra features

  87. Did you make a custom 404 page?
  88. Did you make a site map?
  89. Did you make a rss feed? (if you add content regularly)
  90. Did you make a high contrast version of your website?
  91. Did you make good looking URL’s (like this one)?
  92. Did you make sure that there are no frames on your website?
  93. Did you make sure that there are no pop ups on your website?
  94. Did you make a contact form instead of just an email link?
  95. Any suggestions?

  96. Add number 88 by giving a comment on this post!
原文地址



Jcat 2007-01-25 12:39 发表评论
]]>
online status indicatorhttp://www.aygfsteel.com/Jcat/archive/2006/12/20/88968.htmlJcatJcatWed, 20 Dec 2006 01:34:00 GMThttp://www.aygfsteel.com/Jcat/archive/2006/12/20/88968.htmlhttp://www.aygfsteel.com/Jcat/comments/88968.htmlhttp://www.aygfsteel.com/Jcat/archive/2006/12/20/88968.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/88968.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/88968.htmlQQ                     jcat    jcat

yahoo.cn             yahoo

yahoo                 

onlinestatus.msn   MSN Online Status Indicator   MSN Online Status Indicator  MSN Online Status Indicator


关于msnQ似乎还没有扑ֈ官方的服务(垃圾微YQ,W三Ҏ(gu)供的服务L不太E_


Jcat 2006-12-20 09:34 发表评论
]]>
一些页面自动蟩转的实现http://www.aygfsteel.com/Jcat/archive/2006/11/22/82831.htmlJcatJcatWed, 22 Nov 2006 09:20:00 GMThttp://www.aygfsteel.com/Jcat/archive/2006/11/22/82831.htmlhttp://www.aygfsteel.com/Jcat/comments/82831.htmlhttp://www.aygfsteel.com/Jcat/archive/2006/11/22/82831.html#Feedback2http://www.aygfsteel.com/Jcat/comments/commentRss/82831.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/82831.html功能Q?U后Q自动蟩转到同目录下?2view.html文g
 
1Qhtml的实?br />
<head>
<meta http-equiv="refresh" content="5;url=02view.html">
</head>

优点Q简?br />~点QStruts Tiles中无法?/div>
 
2Qjavascript的实?br />
<script language="javascript" type="text/javascript">
   setTimeout(
"javascript:location.href='02view.html'"5000); 
</script>

优点Q灵z,可以l合更多的其他功?br />~点Q受C同浏览器的媄?/div>
 
3Q结合了倒数的javascript实现QIEQ?br />
<span id="totalSecond">5</span>

<script language="javascript" type="text/javascript">
var second = totalSecond.innerText;
setInterval(
"redirect()"1000);
function redirect(){ 
totalSecond.innerText
=--second; 
if(second<0) location.href='02view.html';
}
</script>

优点Q更人性化
~点Qfirefox不支持(firefox不支持span、div{的innerText属性)
 
3'Q结合了倒数的javascript实现QfirefoxQ?br />
<script language="javascript" type="text/javascript">
    
var second = document.getElementById('totalSecond').textContent;
    setInterval(
"redirect()"1000);
    
function redirect()
    {
        document.getElementById('totalSecond').textContent 
= --second;
        
if (second < 0) location.href = '02view.html';
    }
</script>

4Q解决Firefox不支持innerText的问?br />
<span id="totalSecond">5</span>

<script language="javascript" type="text/javascript">
if(navigator.appName.indexOf("Explorer"> -1){
    document.getElementById('totalSecond').innerText 
= "my text innerText";
else{
    document.getElementById('totalSecond').textContent 
= "my text textContent";
}
</script>

5Q整?Q和3'Q?br />
<span id="totalSecond">5</span>

<script language="javascript" type="text/javascript">
    
var second = document.getElementById('totalSecond').textContent;

    
if (navigator.appName.indexOf("Explorer"> -1)
    {
        second 
= document.getElementById('totalSecond').innerText;
    } 
else
    {
        second 
= document.getElementById('totalSecond').textContent;
    }


    setInterval(
"redirect()"1000);
    
function redirect()
    {
        
if (second < 0)
        {
            location.href 
= '02view.html';
        } 
else
        {
            
if (navigator.appName.indexOf("Explorer"> -1)
            {
                document.getElementById('totalSecond').innerText 
= second--;
            } 
else
            {
                document.getElementById('totalSecond').textContent 
= second--;
            }
        }
    }
</script>


Jcat 2006-11-22 17:20 发表评论
]]>TAKE ALL'S FISHhttp://www.aygfsteel.com/Jcat/archive/2006/08/12/63218.htmlJcatJcatSat, 12 Aug 2006 07:28:00 GMThttp://www.aygfsteel.com/Jcat/archive/2006/08/12/63218.htmlhttp://www.aygfsteel.com/Jcat/comments/63218.htmlhttp://www.aygfsteel.com/Jcat/archive/2006/08/12/63218.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/63218.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/63218.html吉祥三宝

http://struts.apache.org/


http://www.springframework.org/


http://www.hibernate.org/

Apache

http://ant.apache.org/
Apache Ant is a Java-based build tool. In theory, it is kind of like Make, but without Make's wrinkles.

http://lucene.apache.org/

Apache Lucene is a high-performance, full-featured text search engine library written entirely in Java. It is a technology suitable for nearly any application that requires full-text search, especially cross-platform.

http://jakarta.apache.org/commons/index.html
The Commons is a Jakarta subproject focused on all aspects of reusable Java components.

http://jakarta.apache.org/velocity/index.html
Velocity is a Java-based template engine. It permits anyone to use a simple yet powerful template language to reference objects defined in Java code.

Sourceforge

http://junit.sourceforge.net/
JUnit is a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks.

http://httpunit.sourceforge.net/
HttpUnit makes you easy  to be able to bypass the browser and access your site from a program. When combined with a framework such as JUnit, it is fairly easy to write tests that very quickly verify the functioning of a web site.

http://dozer.sourceforge.net/
Dozer is a powerful, yet simple Java Bean to Java Bean mapper that recursively copies data from one object to another. Typically, these Java Beans will be of different complex types.

http://xdoclet.sourceforge.net/xdoclet/index.html
XDoclet is an open source code generation engine. It enables Attribute-Oriented Programming for java. In short, this means that you can add more significance to your code by adding meta data (attributes) to your java sources. This is done in special JavaDoc tags.

http://displaytag.sourceforge.net
The display tag library is an open source suite of custom tags that provide high-level web presentation patterns which will work in an MVC model. Actually the display tag library can just... display tables! Give it a list of objects and it will handle column display, sorting, paging, cropping, grouping, exporting, smart linking and decoration of a table in a customizable XHTML style.

http://cglib.sourceforge.net/
cglib is a powerful, high performance and quality Code Generation Library, It is used to extend JAVA classes and implements interfaces at runtime.

Others

http://www.opensymphony.com/compass/
Compass is a first class open source Java Search Engine Framework, enabling the power of Search Engine semantics to your application stack decoratively. Built on top of the amazing Lucene Search Engine, Compass integrates seamlessly to popular development frameworks like Hibernate and Spring.

http://www.opensymphony.com/quartz/
Quartz is a full-featured, open source job scheduling system that can be integrated with, or used along side virtually any J2EE or J2SE application - from the smallest stand-alone application to the largest e-commerce system.

http://groovy.codehaus.org/
Groovy is an agile dynamic language for the Java Platform with many features that are inspired by languages like Python, Ruby and Smalltalk, making them available to Java developers using a Java-like syntax.

http://www.singularsys.com/jep/
JEP
is a Java library for parsing and evaluating mathematical expressions. With this package you can allow your users to enter an arbitrary formula as a string, and instantly evaluate it. JEP supports user defined variables, constants, and functions. A number of common mathematical functions and constants are included.

http://www.dom4j.org/
dom4j is an easy to use, open source library for working with XML, XPath and XSLT on the Java platform using the Java Collections Framework and with full support for DOM, SAX and JAXP.

http://www.castor.org/
Castor is an Open Source data binding framework for Java. It's the shortest path between Java objects, XML documents and relational tables. Castor provides Java-to-XML binding, Java-to-SQL persistence, and more.


Jcat 2006-08-12 15:28 发表评论
]]>Hello Velocityhttp://www.aygfsteel.com/Jcat/archive/2006/08/08/62271.htmlJcatJcatTue, 08 Aug 2006 00:21:00 GMThttp://www.aygfsteel.com/Jcat/archive/2006/08/08/62271.htmlhttp://www.aygfsteel.com/Jcat/comments/62271.htmlhttp://www.aygfsteel.com/Jcat/archive/2006/08/08/62271.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/62271.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/62271.html单行注释Q?##your note
多行注释Q?#*your note*#

不能直接讉K对象的域Q只能通过Ҏ(gu)来访问。关于方法的调用Q有两种变体QVelocity?x)帮你调用相应的?gu)Q:(x)
1Q对于context中的Hashtable对象Q可以直接用$hashtable.key来得到valueQ相当于$hashtable.get(key)
2Q对于context中的JavaBean对象Q可以直接用$javaBean.property来访问,相当?javaBean.getProperty()

安静引用W(Quiet Reference NotationQ?font color="#ff0000">$!
作用Q当引用的变量ؓ(f)nullӞ输出空字符丌Ӏ(如果?xxxQ当nullӞ?x)输出字W串"$xxx"Q?br />
双引号中?xxx仍然被解析Q单引号中的$xxx不被解析,输出字符?$xxx"

关于路径Q?br />1. 为VelocityEngine指定velocityLoaderPathQ该路径为存放vm文g的根目录Q其下可以徏子文件夹Q无需另外指定Q?br />2. 对vm的引用都是以velocityLoaderPath开始的l对路径。比如:(x)
 |-velocityLoaderPath
   |-a.vm
   |-B
     |-b.vm
在b.vm中引用a.vmQ?parse("a.vm") 正确Q?#parse("../a.vm") 错误

Jcat 2006-08-08 08:21 发表评论
]]>Doohickeyhttp://www.aygfsteel.com/Jcat/archive/2006/08/06/62009.htmlJcatJcatSat, 05 Aug 2006 16:27:00 GMThttp://www.aygfsteel.com/Jcat/archive/2006/08/06/62009.htmlhttp://www.aygfsteel.com/Jcat/comments/62009.htmlhttp://www.aygfsteel.com/Jcat/archive/2006/08/06/62009.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/62009.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/62009.html 最后的逗号
String[] strs = {"1", "2", "3", };
System.out.println(strs.length); //3

q竟然是W合语法的!

ArrayInitializer:       
{ [VariableInitializer {, VariableInitializer} [,]] }
VariableInitializer: ArrayInitializer Expression
http://java.sun.com/docs/books/jls/third_edition/html/syntax.html#18.1

"This is good for quick testing. I always use this. In my case, I have a table, sometimes I care some columns, other times I care some other columns, so I am lazy to remove the last comma when I change columns. It's convenient."



q行没有main的javac?br />      通常我们需要在javacMdmain函数才能在命令行q行q个c,但是有一U(可以让你晕死的)Ҏ(gu)可以让你在没有main的情况下也可以运行java classQ当然不是用appletQ,代码如下Q?/span>

public   class  NoMainMethod
{
    
static
{
        System.out.println(
" Hello word, no main method! " );
        System.exit(
0 );
    }

}

      static语句块会(x)在加载类的时候加载,它在main函数之前q行?当static语句块运行完毕后Q会(x)Lmain函数Q如果没有找刎ͼ׃(x)抛出异常。但是在以上的代码中Qstatic语句块执行后Q我们终止程序的q行Q所以异常就不会(x)被抛出啦?br />

跛_JavaBean的命名规?br />      通常QJavaBean的命名规范ؓ(f)Q属性名的第二个字母也不能大写。即不可以出现类?aAndB q样的属性名。如QHibernate的PO如果出现q样的名字,抛出net.sf.hibernate.PropertyNotFoundException异常。但是有一个办法可以解册问题Q?br />

java file:     
private  String aAndB;   
public  String getAAndB()  {        
        
return  aAndB;   
}
   
public   void  setAAndB(String aAndB)  {       
         this .aAndB  =  aAndB;   
}

mapping.xml < property  name ="AAndB"  column ="a_and_b" />
      l研I发玎ͼ上述办法可以成功的将aAndBq样的属性与数据库mappingh?br />      昄hibernate是通过setter和getter来访问对象的属性的Q所以我们可以说Qmapping.xmlq不是在cȝ属性和数据库的字段名之间做映射Q而是在setter/getter和数据库的字D之间做映射?font color="red">
      诚然Q即使可以也别这么干Q实际工作中Q还是规避这U问题的好?/font> 



Jcat 2006-08-06 00:27 发表评论
]]>
Read source code is a good way to learn anything!http://www.aygfsteel.com/Jcat/archive/2006/08/03/61560.htmlJcatJcatThu, 03 Aug 2006 10:43:00 GMThttp://www.aygfsteel.com/Jcat/archive/2006/08/03/61560.htmlhttp://www.aygfsteel.com/Jcat/comments/61560.htmlhttp://www.aygfsteel.com/Jcat/archive/2006/08/03/61560.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/61560.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/61560.html Experience
To know how dose List.remove(Object) work, I do many test sample. But I still feel not very realizing. Finally, I took a look at souce code, and then I knew everything!
public boolean remove(Object o) {
    
if (o == null{
            
for (int index = 0; index < size; index++)
        
if (elementData[index] == null{
            fastRemove(index);
            
return true;
        }

    }
 else {
        
for (int index = 0; index < size; index++)
        
if (o.equals(elementData[index])) {
            fastRemove(index);
            
return true;
        }

        }

    
return false;
    }
1. List store very object's reference but object's own.
2. remove(Object) will remove the first reference in List which refer to the object
3. If you want to change an object to a new index: back up it--> remove it--> re-add it

Experience
I create a class to handle something annotated by Annotations. But it doesn't work. I found out it is returned false by Class.getMethod().isAnnotationPresent(Todo.class). Finally, I got the reason by reading source code.
public enum RetentionPolicy {
    
/**
     * Annotations are to be discarded by the compiler.
     
*/
    SOURCE,

    
/**
     * Annotations are to be recorded in the class file by the compiler
     * but need not be retained by the VM at run time.  This is the default
     * behavior.
     
*/
    CLASS,

    
/**
     * Annotations are to be recorded in the class file by the compiler and
     * retained by the VM at run time, so they may be read reflectively.
     *
     * 
@see java.lang.reflect.AnnotatedElement
     
*/
    RUNTIME
}



Jcat 2006-08-03 18:43 发表评论
]]>错不断Q大错不?/title><link>http://www.aygfsteel.com/Jcat/archive/2006/07/25/59975.html</link><dc:creator>Jcat</dc:creator><author>Jcat</author><pubDate>Tue, 25 Jul 2006 05:11:00 GMT</pubDate><guid>http://www.aygfsteel.com/Jcat/archive/2006/07/25/59975.html</guid><wfw:comment>http://www.aygfsteel.com/Jcat/comments/59975.html</wfw:comment><comments>http://www.aygfsteel.com/Jcat/archive/2006/07/25/59975.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/Jcat/comments/commentRss/59975.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/Jcat/services/trackbacks/59975.html</trackback:ping><description><![CDATA[?img src="http://www.aygfsteel.com/Emoticons/QQ/god.gif" border="0" height="20" width="20" />Ӟ(x)刚配|好strutsQ可是DispatchAction怎么都不工作QAction可以工作Q,也不报错<br />原因Q只引入了struts自n的jarQ看一看release中lib下,q有不少非struts的jarQ可以猜惌些都是DispatchAction所需要的Q而Action不需要(以前以ؓ(f)q些没用Q。不报错让我很郁闗?br /><br /><br /><br />?img src="http://www.aygfsteel.com/Emoticons/QQ/god.gif" border="0" height="20" width="20" />Ӟ(x)刚配|好strutsQaction可以工作了,是不能正确的forward到jsp面Qexecute中加断点Q也不进入?br />原因Qexecute有两个!Q!<span style="font-weight: bold;">Http</span>ServletRequest vs ServletRequestQ前者才是struts所使用的execute?br /><br /><br /><br />?img src="http://www.aygfsteel.com/Emoticons/QQ/god.gif" border="0" height="20" width="20" />Ӟ(x)在web.xml里面讄好了<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">error-page</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">error-code</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">404</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">error-code</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">location</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">/404.jsp</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">location</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">error-page</span><span style="color: rgb(0, 0, 255);">></span></div><br />但当出现<strong>404</strong>错误Ӟq没有显C?04.jspq一,而是昄browser提供的error report page<br /><br />原因Q在客户端浏览器如IE的internet选项高属性中默认使用“友好的http错误信息”,q样?x)造成你的服务器是输出你所定义的错误页面,但到客户端被IEq؜蛋给覆盖掉了。解x案是你定义的错误面的大必d?strong><font color="#ff0000">512bytes</font></strong>Q就不会(x)被客L(fng)讄所影响了?<br /><br /><br /><br />?img src="http://www.aygfsteel.com/Emoticons/QQ/god.gif" border="0" height="20" width="20" />Ӟ(x)用hibernate讉K数据库,可以insertQ可以selectQ可以dropQ就是不?strong>update</strong>Q而且没有M错误消息<br /><br />原因Q?br /><class name="com.verican.base.model.CatalogPO" table="sys_catalog" mutable="<strong>false</strong>">讄?strong><font color="#ff0000">true</font></strong>卛_?br />Q当mutableQfalseQ却又执行update操作Ӟhibernate臛_应该提供警告消息告知一下才?可惜没有Q所以很隑֏玎ͼ<br /><br /><br /><br />?img src="http://www.aygfsteel.com/Emoticons/QQ/god.gif" border="0" height="20" width="20" />Ӟ(x)<br />      Javascript弹出H口Ӟ如果用的是相对\径,形如javascript:void(window.open('<strong><font color="#0000ff">../../</font></strong>test.html'))Q不同的览器的处理不同Q因为js是浏览器处理的东西)?br />      比如Q不是部|在根目录下Ӟ根目录下又徏了一个目录)Q在Firefox下,是以服务器ؓ(f)视角Q则<font color="#0000ff"><strong>../../</strong></font>卛_Q而在IE下,则是以浏览器角,则需要多加一U,?strong><font color="#0000ff">../../../</font></strong>?br />            <br />解决Q用l对路径 javascript:void(window.open('http://www.verican.com/test.html'))Q或者,?<a <strong><font color="#ff0000">target="_blank"</font></strong> href="../../test.html"> Q因是服务器处理的东西,所以不部|在哪里Q相对\径都是唯一定的)<br /><br /><br /><br />?img src="http://www.aygfsteel.com/Emoticons/QQ/god.gif" border="0" height="20" width="20" />Ӟ(x)<br />h的时?1Q抛出ServletException<br />                     2QThe page cannot be refreshed without resending the information, Click Retry to send the information again.<br /><br />原因QStruts中redirect讄问题Q具体原理以后再研究Q?br /><br />解决Q一般的QforwardC个具体的pageQredirectQfalseQforward到另一个actionQredirectQtrue<br />            <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">forward </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="add_item"</span><span style="color: rgb(255, 0, 0);"> path</span><span style="color: rgb(0, 0, 255);">="newsletter.add_item.page"</span><span style="color: rgb(255, 0, 0);"> redirect</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">forward </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="success"</span><span style="color: rgb(255, 0, 0);"> path</span><span style="color: rgb(0, 0, 255);">="/newsletter.do"</span><span style="color: rgb(255, 0, 0);"> redirect</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(0, 0, 255);">/></span></div><br /><br />?img src="http://www.aygfsteel.com/Emoticons/QQ/god.gif" border="0" height="20" width="20" />Ӟ(x)<br /><p class="MsoNormal" style="margin: 0in 0in 0pt;">save a form <span style="font-family: Wingdings;"><span>--></span></span> forward to list page <span style="font-family: Wingdings;"><span>--></span></span> refresh <span style="font-family: Wingdings;"><span>--></span></span> retry <span style="font-family: Wingdings;"><span>--> </span></span><span style="color: red;">save the form again (error)</span></p><br />原因Q?br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">forward </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="list"</span><span style="color: rgb(255, 0, 0);"> path</span><span style="color: rgb(0, 0, 255);">="ticket.list.page"</span><span style="color: rgb(255, 0, 0);"> redirect</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(0, 0, 255);">/></span></div><br />解决Q一般的Q从save一个表单后Q应该forward到另一个actionQ且redirectQtrueQ而不是另一个pageQ即便当前action里有q个pageQ。这样可以保证不?x)通过h重复save数据?br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">forward </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="list"</span><span style="color: rgb(255, 0, 0);"> path</span><span style="color: rgb(0, 0, 255);">="ticket.do"</span><span style="color: rgb(255, 0, 0);"> redirect</span><span style="color: rgb(0, 0, 255);">="true"</span><span style="color: rgb(0, 0, 255);">/></span></div><br /><br /><br />?img src="http://www.aygfsteel.com/Emoticons/QQ/god.gif" border="0" height="20" width="20" />Ӟ(x)<br />      用Spring + Velocity发emailQ开始都好好的,也能现实囄Q但当加入某一q图片以后,无法正常昄Q得C个页面ؓ(f)I白的EmailQ虽然也有大)。把囄从bmp换到jpgQ再换到gifQ未果。减图片的寸、大,未果。几乎都要绝望了~~?br /><br />原因Q?font color="#ff0000">NOTE: Invoke addInline after setText; else, mail readers might not be able to resolve inline references correctly.</font><font color="#000000">Q这是Spring API里的原话QNNDQ?br /><br />感受Q?br />      1.以前没写q发Email的程序,工作中用CQ照猫画虎拿q来qQ也没有仔细阅读文档Q导致这ơ惨痛的教训?br />      2.Spring中这部分设计的也有问题,它在两个表面上没什么关pȝҎ(gu)之间Q徏立了<font color="#ff1493">序上的依赖关系</font>。这使得出现q种情况Ӟ没有MU烦?br /><br /><br /><br />?img src="http://www.aygfsteel.com/Emoticons/QQ/god.gif" border="0" height="20" width="20" />Ӟ(x)<br />遍历ListӞ一调用remove出错,Q错误的Q代码如?br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (Object o : list)<br /><img id="Codehighlighter1_30_68_Open_Image" onclick="this.style.display='none'; codehighlighter1_30_68_open_text.style.display=" none="" ;="" codehighlighter1_30_68_closed_image.style.display="'inline';" codehighlighter1_30_68_closed_text.style.display="'inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_30_68_Closed_Image" style="display: none;" onclick="this.style.display='none'; codehighlighter1_30_68_closed_text.style.display=" none="" ;="" codehighlighter1_30_68_open_image.style.display="'inline';" codehighlighter1_30_68_open_text.style.display="'inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />    </span><span id="Codehighlighter1_30_68_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />            list.remove(o);<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />        }</span></span></div></font><br />原因QConcurrentModificationExceptionQ有remove操作Ӟ不能用foreach循环<br /><br />解决Q用传统循环Q看了传l还是很有用的)<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; i </span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);"> list.size(); i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">)<br /><img id="Codehighlighter1_46_86_Open_Image" onclick="this.style.display='none'; codehighlighter1_46_86_open_text.style.display=" none="" ;="" codehighlighter1_46_86_closed_image.style.display="'inline';" codehighlighter1_46_86_closed_text.style.display="'inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_46_86_Closed_Image" style="display: none;" onclick="this.style.display='none'; codehighlighter1_46_86_closed_text.style.display=" none="" ;="" codehighlighter1_46_86_open_image.style.display="'inline';" codehighlighter1_46_86_open_text.style.display="'inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />    </span><span id="Codehighlighter1_46_86_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />            list.remove(i</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">);<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />        }</span></span></div> 注意removeq?strong><font color="#ff0000">?/font></strong>需?<font color="#ff0000"><strong>i--  </strong></font><font color="#000000"><strong>(--i is wrong)<br /><br /><br /><br /></strong>?img src="http://www.aygfsteel.com/Emoticons/QQ/god.gif" border="0" height="20" width="20" />Ӟ(x)<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);">boolean</span><span style="color: rgb(0, 0, 0);"> b </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Integer(</span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Integer(</span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">); </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">false</span></div><div><br />原因Q其实是很简单的问题Q但是IDEA只会(x)对String?= = 做智能提C,注意卛_?br /><br /><br /><br />?img src="http://www.aygfsteel.com/Emoticons/QQ/god.gif" border="0" height="20" width="20" />Ӟ(x)<br />org.hibernate.MappingException: Could not read mappings from resource: jcat/learn/mapping.xml</div><div> </div><div>开始以\径没写对Q试验了N中\径的写发后,q是不行。后来才发现是因为mapping.xml是空的?/div><div> </div><div>解决Q给mapping.xml加上一个空壛_可以了(好歹I壳不等于空Q?/div><div> </div><div><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);"><?</span><span style="color: rgb(255, 0, 255);">xml version="1.0" encoding="gb2312"</span><span style="color: rgb(0, 0, 255);">?></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);"><!</span><span style="color: rgb(255, 0, 255);">DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" </span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">hibernate-mapping </span><span style="color: rgb(255, 0, 0);">default-lazy</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">hibernate-mapping</span><span style="color: rgb(0, 0, 255);">></span></div></div><div> </div><div>NOTEQ几U\径的写法<br />1. <strong>classpath:packagename/filename<br /></strong>例子Q在applicationContext.xml中注册hibernate.cfg.xml<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">bean </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="GlobalHibernateSessionFactory"</span><span style="color: rgb(255, 0, 0);"> class</span><span style="color: rgb(0, 0, 255);">="org.springframework.orm.hibernate3.LocalSessionFactoryBean"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="dataSource"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />            </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">ref </span><span style="color: rgb(255, 0, 0);">local</span><span style="color: rgb(0, 0, 255);">="GlobalDataSource"</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">property </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="configLocation"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />            </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">classpath:hibernate.cfg.xml</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">bean</span><span style="color: rgb(0, 0, 255);">></span></div></div><div><br />2. <strong>packagename/filename</strong><br />例子Q在hibernate.cfg.xml中注册mapping.xml<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">mapping </span><span style="color: rgb(255, 0, 0);">resource</span><span style="color: rgb(0, 0, 255);">="jcat/learn/hibernate_in_spring/orm.xml"</span><span style="color: rgb(0, 0, 255);">/></span></div></div></font><br /><br />?img src="http://www.aygfsteel.com/Emoticons/QQ/god.gif" border="0" height="20" width="20" />Ӟ(x)提交表单E序Q加入了上传文g的功能后Q出现异?br />java.lang.IllegalArgumentException: Cannot invoke com.verican.newsadmin.form.TicketForm.setUploadFile - <font color="#ff0000">argument type mismatch<br /><br /><font color="#000000">解决Q将表单声明?font color="#ffa500">mulptipart</font>cd</font><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">html:form </span><span style="color: rgb(255, 0, 0);">action</span><span style="color: rgb(0, 0, 255);">="/ticket"</span><span style="color: rgb(255, 0, 0);"> <strong><font color="#ffa500">enctype</font></strong></span><span style="color: rgb(0, 0, 255);"><strong><font color="#ffa500">="multipart/form-data"</font></strong></span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />         </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">html:file </span><span style="color: rgb(255, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">="uploadFile"</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">html:form</span><span style="color: rgb(0, 0, 255);">></span></div></font><br /><br /><br />?img src="http://www.aygfsteel.com/Emoticons/QQ/god.gif" border="0" height="20" width="20" />Ӟ(x)IE cannot open the Internet site file: ....<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">></</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">head</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">span </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="TypeDes2"</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br /><img id="Codehighlighter1_110_155_Open_Image" onclick="this.style.display='none'; codehighlighter1_110_155_open_text.style.display=" none="" ;="" codehighlighter1_110_155_closed_image.style.display="'inline';" codehighlighter1_110_155_closed_text.style.display="'inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_110_155_Closed_Image" style="display: none;" onclick="this.style.display='none'; codehighlighter1_110_155_closed_text.style.display=" none="" ;="" codehighlighter1_110_155_open_image.style.display="'inline';" codehighlighter1_110_155_open_text.style.display="'inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />    </span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(0, 0, 255);">></span><span id="Codehighlighter1_110_155_Closed_Text" style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);"><img src="http://www.aygfsteel.com/images/dot.gif" /></span><span id="Codehighlighter1_110_155_Open_Text"><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />       TypeDes2.innerHTML </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">=</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);"> </span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">Test Span</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">"</span><span style="color: rgb(0, 0, 0); background-color: rgb(245, 245, 245);">;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />    </span></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">></span></div><br />解决Q对于单标签Q浏览器找不到innerHTML属性。改为双标签卛_?br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">span </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="TypeDes2"</span><span style="color: rgb(0, 0, 255);">></</span><span style="color: rgb(128, 0, 0);">span</span><span style="color: rgb(0, 0, 255);">></span></div><img src ="http://www.aygfsteel.com/Jcat/aggbug/59975.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/Jcat/" target="_blank">Jcat</a> 2006-07-25 13:11 <a href="http://www.aygfsteel.com/Jcat/archive/2006/07/25/59975.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Hello Hibernatehttp://www.aygfsteel.com/Jcat/archive/2006/07/03/56338.htmlJcatJcatMon, 03 Jul 2006 06:24:00 GMThttp://www.aygfsteel.com/Jcat/archive/2006/07/03/56338.htmlhttp://www.aygfsteel.com/Jcat/comments/56338.htmlhttp://www.aygfsteel.com/Jcat/archive/2006/07/03/56338.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/56338.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/56338.html POJO principle

 

1. The class can not be final

 

2. Must implement Serializable

 

3. Must contain a non-argument constructor

 

4. The getter and setter must be public

 



Jcat 2006-07-03 14:24 发表评论
]]>
Keymap in IntelliJhttp://www.aygfsteel.com/Jcat/archive/2006/06/26/55223.htmlJcatJcatMon, 26 Jun 2006 13:26:00 GMThttp://www.aygfsteel.com/Jcat/archive/2006/06/26/55223.htmlhttp://www.aygfsteel.com/Jcat/comments/55223.htmlhttp://www.aygfsteel.com/Jcat/archive/2006/06/26/55223.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/55223.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/55223.html阅读全文

Jcat 2006-06-26 21:26 发表评论
]]>
Some useful IntelliJ Pluginhttp://www.aygfsteel.com/Jcat/archive/2006/06/24/54850.htmlJcatJcatSat, 24 Jun 2006 05:01:00 GMThttp://www.aygfsteel.com/Jcat/archive/2006/06/24/54850.htmlhttp://www.aygfsteel.com/Jcat/comments/54850.htmlhttp://www.aygfsteel.com/Jcat/archive/2006/06/24/54850.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/54850.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/54850.html==must be installed==

RegexPlugin
http://www.intellij.org/twiki/bin/view/Main/RegexPlugin

unitTest: better (and also bigger) than JunitGenerator

CVS bar: VCS bar is too old

SpellCheckPlugin
http://www.intellij.org/twiki/bin/view/Main/SpellCheck

DBHelper: more powerful than  SQL Query Plugin. Maybe the latter will be removed after I am familiar with DBHelper.
http://ca.geocities.com/davidhuo2003/dbhelper.html

Rearranger: use it in canonical class, such as bean  
http://www.intellij.org/twiki/bin/view/Main/RearrangerPlugin

simpleUML  
http://www.intellij.org/twiki/bin/view/Main/SimpleUML

Key promoter: Shows to user how easy he can make same action using only keyboard


==good for using==

IdeaMouseGestures: IdeaMouseGestures plugin provides easy way to assign Idea's menu items to mouse gestures.
http://www.smardec.com/products/idea.html

KonaWorks PowerPack: A new code action to easily insert an expression inside a string literal
http://www.konaworks.org/

DragNDrop: This plugin will allow a user to drag and drop files into the main pane of IntelliJ

Workspaces
http://www.intellij.org/twiki/bin/view/Main/WorkspacesPlugin

RemoteTail: The plugin allows the user to view the content of a file which could be on a different computer.

Jump to Usage: Simple plugin to make navigation to element usages easier than using Alt+F7.
http://sourceforge.net/projects/jumptousage

Library Finder: helps to find library files (.jar/.zip) for a "fully qualified" class/resource name.
http://code.google.com/p/libraryfinder/

IntelliLang: IntelliLang is a combination of three basic kinds of functionality that are meant to support the developer in dealing with certain tasks that relate to (custom) languages in IntelliJ IDEA.
http://www.jetbrains.net/confluence/display/CONTEST/IntelliLang

XPathView + XSLT-Support: required by IntelliLang
http://www.intellij.org/twiki/bin/view/Main/XPathViewPlugin

Tabifier: The tabifier plugin retabs Java code so that syntactic elements are aligned vertically. 
http://www.intellij.org/twiki/bin/view/Main/TabifierPlugin

Struts Assistant: it will conflict with Struts Plugin, so Struts Assistant is enough.
http://www.intellij.org/twiki/bin/view/Main/StrutsAssistant

IdeaSpring: Helpful to edit applicationContext.xml. But it is even a commercial one! So it has to be re-download every 15 days.

XFile: defaul Changes is good enough, so maybe it will be removed later.
http://www.echologic.com/plugins/xfiles.html

UpperLowerCapitalize: just use the capticalize, since there is default upper/lower in IDEA
http://www.intellij.org/twiki/bin/view/Main/UpperLowerCapitalize

IdeaJad: a popular decompiler
http://www.tagtraum.com/ideajad.html

SyncEdit: Remove the default shortcut "Tab" (for "Next SyncEditable Word"), since I need "Tab" work normally.

World of Java
http://www.worldofjava.org/

Scratch Pad: Additional editor tool window to hold pieces of code temporarily. No syntax colouring, intentions or error highlighting.
http://www.intellij.org/twiki/bin/view/Main/ScratchPadPlugin

HTML Preview: Provides preview for html files using Mozilla browser


==learning==

TabSwitch: Open files/tabs switcher

CVS Report for IntelliJ IDEA: CVS Report for IntelliJ IDEA is a free open source plugin for IntelliJ IDEA to generate statistical reports from your CVS repository.
http://vcsreport.sourceforge.net/

RssPlugin: RSS Plugin for viewing RSS feeds within IntelliJ.
http://www.intellij.org/twiki/bin/view/Main/RssPlugin

Hibernate Tools: better than hibero which is even a commercial one!

Smart Introduce: how to use it?
http://www.intellij.org/twiki/bin/view/Main/SmartIntroducePlugin

GroovyJ: hoping it can become more powerful
http://groovy.codehaus.org/IntelliJ+IDEA+Plugin


==not very useful, so can be ignore==

Code Outline: Have not found anything useful  (dosen't work in IDEA 6.0)

OpenContainingForder: Plugin for Viewing folders with Windows Explorer, but cannot open a folder. So "Alt+Shift+E" is better 

LineMover: default "Ctrl+Shift+Up/Down" is enough.

SQL Query Plugin: DBHelper is good enough

SQL script editor: DBHelper is good enough

JavaDoc Browser: the window can't be big enough, so acutal browser (such as fire fox) is better.



BTW: if you have any good recommendation, welcome to share with us. 



Jcat 2006-06-24 13:01 发表评论
]]>
Hello Tomcathttp://www.aygfsteel.com/Jcat/archive/2006/06/23/54606.htmlJcatJcatFri, 23 Jun 2006 01:11:00 GMThttp://www.aygfsteel.com/Jcat/archive/2006/06/23/54606.htmlhttp://www.aygfsteel.com/Jcat/comments/54606.htmlhttp://www.aygfsteel.com/Jcat/archive/2006/06/23/54606.html#Feedback0http://www.aygfsteel.com/Jcat/comments/commentRss/54606.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/54606.html 1. Tomcat config file, where you can change Tomcat's port number: <CATALINA_HOME>/conf/server.xml  

<  Host ...   >  
       ...
       
<  Context   path  ="/app1"   docBase  ="app1"   debug  ="0"   reloadable  ="true"   />
 
       
<  Context   path  ="/app2"   docBase  ="app2"   debug  ="0"   reloadable  ="true"   />
 
       
<  Context   path  ="root url"   docBase  ="root dir (or the path of .war)"   debug  ="0"   reloadable  ="note1"   >
 
< / Host >
  


note1: whether auto-reload the web application, when .class file is changed
              1) during developing, set reloadable=true
              2) after deployment, set reloadable=false


2. Some libs

/server/lib 

just for Tomcat

/shared/lib

for all web apps

/common/lib

both Tomcat and all web apps

/webapps/jcat/WEB-INF/lib

just present web app

 

3. Immobile Directory Structure (the names are also immobile, include uppercase/lowercase) 
   /jcat
   /jcat/WEB-INF
   /jcat/WEB-INF/web.xml
   /jcat/WEB-INF/classes
   /jcat/WEB-INF/lib

     

Note: WEB-INF/classes is loaded by tomcat before WEB-INF/lib , so classes has priority than lib

 
4. Scopes
      ApplicationQ在整个web应用E序内有效。对应于servelet中的ServletContext对象QAction中的获取QgetServlet().getServletContext()
      SessionQ在一个用户与服务器徏立连接的整个q程中有效。Action中的获取QhttpServletRequest.getSession()
      RequestQ在一个请求周期内有效。就是从你点击页面上的一个按钮开始到服务器返回响应页面ؓ(f)止(包括响应面Q?br />      PageQ仅在一个jsp面内有效?br />


*1*
 
Request in Struts: PageFrom (request.setAttribute by using Form)-->Action(request.getAttribute&setAttribute)-->PageTo (request.getAttribute by using EL) 

*2* :
Parameter vs Attribute in request
   Parameter ?/span> URL 带过来的参数Q只能是?/span> String Q如
www.verican.com/test?para1=1&para2=ttt
   ?/span> Action 中的调用Q?/span>
request.getParameter("para1"); 
   在响应页面中的调用:(x) ${param.para1} Q?/span> param ?/span> EL 的隐藏对象) 


   Attribute
一般是 Form 带过来的属性,可以是Q何对?br />    ?/span> Action 中的调用Q一般已l存在于 Form 对象?
   在响应页面中的调用:(x) ${attributeName.xxx} 
Q?/span> EL ?x)自动调?/span> getXxx Ҏ(gu)Q所以该 attribute 必须实现 getXxx Ҏ(gu)Q?/span>

5. Web server跟踪客户状态的四种Ҏ(gu)QHTTP是无状态的协议Q?br />    1Q徏立含有跟t数据的隐藏表格字段
    2Q重写包含额外参数的URL
    3Q用持l的Cookie
    4Q用Servlet API中的Session机制

6. JavaBean的标?br />   1) should be a public class
   2) should have a non-argument constructor
   3) fields should be privated, and using get & set to access them
   4) also can have some other functions as a common class



Jcat 2006-06-23 09:11 发表评论
]]>
How to use jar to implement double-click-run like .exe filehttp://www.aygfsteel.com/Jcat/archive/2006/06/19/53857.htmlJcatJcatMon, 19 Jun 2006 14:45:00 GMThttp://www.aygfsteel.com/Jcat/archive/2006/06/19/53857.htmlhttp://www.aygfsteel.com/Jcat/comments/53857.htmlhttp://www.aygfsteel.com/Jcat/archive/2006/06/19/53857.html#Feedback2http://www.aygfsteel.com/Jcat/comments/commentRss/53857.htmlhttp://www.aygfsteel.com/Jcat/services/trackbacks/53857.html1. workdir=learnJar

目录l构
+ learnJar
 | mf.mf
 |+ test
   | Test.java
 
2. workdir>javac test\Test.java

+ learnJar
 | mf.mf 
 |+ test
   | Test.java
   | Test.class

3. workdir>jar cvfm a.jar mf.mf test\Test.class

+ learnJar
 | mf.mf
 |+ test
   | Test.java
   | Test.class
 |+ a.jar
   |+ META-INF
     | MANIFEST.MF
   |+ test
     | Test.class

 4. workdir>java -jar a.jar
hello world


NOTE
1. manifest.mf可以攑֜M位置Q也可以是其它的文g?反正最后jar中的文g名会(x)被自动变为MANIFEST.MF)
2. "Manifest-Version: 1.0"--该行(以及其它?冒号后面必须是个I格Q否则jar时出?invalid header field"
3. "Main-Class: test.Test<回R>"--该行必须以一个回车符l束Q否则无效?br />4. 如果?font color="#0000ff">有UI的程?/font>Q?font color="#0000ff">双击jar文g卛_q行?如果安装了winrar{压~YӞjar文g?x)被兌Q因此,双击时ƈ不会(x)执行jarE序Q而是调用压羃软g来打开jar文gQ这Ӟjar的关联去掉即?

Appendix
Test.java

package  test;

import  javax.swing. * ;

public   class  Test  extends  JFrame {
    
public   static   void  main(String[] args) {
        Test impl
= new  Test();
        JLabel label 
=   new  JLabel( " hello world " );
        impl.add(label);
            impl.pack();
        impl.setVisible(
true );
    }

}

mf.mf
Manifest-Version: 1.0
Main
-Class: test.Test
<回R>


Jcat 2006-06-19 22:45 发表评论
]]>
վ֩ģ壺 | ˮ| | | ׿| ͨ| | ӽ| | | | | | Ϫ| | ̫ԭ| | | | ȫ| γ| | | | | | ޻| Ž| | | Զ| ͨ| ˾| ߶| | | ľ| | | | Դ|