??xml version="1.0" encoding="utf-8" standalone="yes"?>午夜精品视频一区,作爱视频免费观看视频在线播放激情网 ,国产精品永久免费视频http://www.aygfsteel.com/Johncn/archive/2006/01/07/27021.htmlZhuJunZhuJunSat, 07 Jan 2006 12:46:00 GMThttp://www.aygfsteel.com/Johncn/archive/2006/01/07/27021.htmlhttp://www.aygfsteel.com/Johncn/comments/27021.htmlhttp://www.aygfsteel.com/Johncn/archive/2006/01/07/27021.html#Feedback0http://www.aygfsteel.com/Johncn/comments/commentRss/27021.htmlhttp://www.aygfsteel.com/Johncn/services/trackbacks/27021.html    目中实现多语言国际化都是通过使用<bean:message>标签和资源文?但是如果把所有的面说明都加入一个资源文件中,通常的后果是q个文g会越来越?而且开发中不同的h加入的格式也不一?到最后很可能是谁也不知道到底资源文g中有些什么内?如果有新的开发h员加入的?很可能只好再自己需要用C么再l箋加进文g.最后维护这L文g变成很痛苦的事情.
    所以想要用多个资源文?q样可以Ҏ不同的划分规?功能,位置,词?不同的内容攑օ不同的文?方便l护.
具体的做?
1.创徏属性文件ƈ且在struts-config.xml中ؓ每一个文件声明一个message-resources元素?/STRONG>
<message-resources
  
parameter="com.oreilly.strutsckbk.MessageResources"/>

<message-resources 
  
parameter="com.oreilly.strutsckbk.LabelResources"

  key
="labels">
</message-resources>
<message-resources 
  
parameter="com.oreilly.strutsckbk.HeaderResources"

  key
="headers">
</message-resources>
注意:q里多了一个属?STRONG>key
,q就是用来在面标签中区分不同的资源文g?标签默认是用没有说?STRONG>key值的那个资源文g.

2.使用<bean:message>标签:
<bean:message bundle="labels" key="label.url"/>
注意:q里?STRONG>bundle属性就是用来指明上面提到的key属性的,以表明这?lt;bean:message>标签是要使用哪个资源文g.

说明:只能在struts1.1以上版本使用多个资源文g,struts1.0不支?lt;message-resource>属?所以不能实C面的用法.


ZhuJun 2006-01-07 20:46 发表评论
]]>
[Tomcat] 修改Tomcat端口?/title><link>http://www.aygfsteel.com/Johncn/archive/2006/01/02/26406.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Mon, 02 Jan 2006 15:42:00 GMT</pubDate><guid>http://www.aygfsteel.com/Johncn/archive/2006/01/02/26406.html</guid><wfw:comment>http://www.aygfsteel.com/Johncn/comments/26406.html</wfw:comment><comments>http://www.aygfsteel.com/Johncn/archive/2006/01/02/26406.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/Johncn/comments/commentRss/26406.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/Johncn/services/trackbacks/26406.html</trackback:ping><description><![CDATA[<div id="wmqeeuq" class=postcontent> <P><FONT face=Arial size=2>安装了Oracle?启动Tomcat时出现错?</FONT></P> <P><FONT face=Arial color=#ff0000 size=2>Error starting endpoint<BR>java.net.BindException: Address already in use: JVM_Bind:8080</FONT></P> <P><FONT face=Arial color=#000000 size=2>原来Oracle的Servlet Engine也用了8080端口.那就来修改Tomcat的端?</FONT></P> <P><FONT face=Arial size=2>首相扑ֈ<FONT color=#0000cc>Tomcat 5.0\conf\server.xml</FONT>文g,然后扑ֈ下面的代?<BR></P> <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"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">    port="8080"               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>               enableLookups="false" redirectPort="8443" acceptCount="100"<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>               debug="0" connectionTimeout="20000" <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>               disableUploadTimeout="true" /></SPAN></DIV> <P></FONT><FONT face=Arial size=2>修改 port="8080" Z惌的端口就可以?</FONT></P></DIV><img src ="http://www.aygfsteel.com/Johncn/aggbug/26406.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/Johncn/" target="_blank">ZhuJun</a> 2006-01-02 23:42 <a href="http://www.aygfsteel.com/Johncn/archive/2006/01/02/26406.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Velocity] Velocity 参考资?/title><link>http://www.aygfsteel.com/Johncn/archive/2006/01/02/26400.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Mon, 02 Jan 2006 15:25:00 GMT</pubDate><guid>http://www.aygfsteel.com/Johncn/archive/2006/01/02/26400.html</guid><wfw:comment>http://www.aygfsteel.com/Johncn/comments/26400.html</wfw:comment><comments>http://www.aygfsteel.com/Johncn/archive/2006/01/02/26400.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/Johncn/comments/commentRss/26400.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/Johncn/services/trackbacks/26400.html</trackback:ping><description><![CDATA[     摘要: Velocity 参考资? John Zhu 2005-4-7   原文:http://jakarta.apache.org/velocity/user-guide.html VTL Reference: http://jakarta.apache.org/velocity/vtl-reference-guide.html Develop...  <a href='http://www.aygfsteel.com/Johncn/archive/2006/01/02/26400.html'>阅读全文</a><img src ="http://www.aygfsteel.com/Johncn/aggbug/26400.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/Johncn/" target="_blank">ZhuJun</a> 2006-01-02 23:25 <a href="http://www.aygfsteel.com/Johncn/archive/2006/01/02/26400.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Eclipse] 在Eclipse中安装Visual Editor插ghttp://www.aygfsteel.com/Johncn/archive/2006/01/02/26398.htmlZhuJunZhuJunMon, 02 Jan 2006 15:22:00 GMThttp://www.aygfsteel.com/Johncn/archive/2006/01/02/26398.htmlhttp://www.aygfsteel.com/Johncn/comments/26398.htmlhttp://www.aygfsteel.com/Johncn/archive/2006/01/02/26398.html#Feedback0http://www.aygfsteel.com/Johncn/comments/commentRss/26398.htmlhttp://www.aygfsteel.com/Johncn/services/trackbacks/26398.html在Eclipse中进行GUI开发需要安装Visual Editor插g:
1.Install Omondo UML(包括了VE插g所需要的EMF,GEF,q包括UML2插g):
2.Install Visual Editor插g:
  • ?/FONT>http://www.eclipse.org/vep/下蝲VE-runtime-1.0.2.1.zip;
  • VE -runtime-1.0.2.1.zip解压到c:\eclipse-plugins(可以是Q何目??在Eclipse的安装\径下的links 目录中徏立一个link文g,比如gui.ve.link,文g内容?nbsp; path=c:/eclipse-plugins/VE-runtime- 1.0.2.1, 卌个link文g要对应一个刚解压后的插g目录?注意:此目录中应包含eclipse/(features|plugins)l构);
  • 启动eclipse卛_,安装完成;

3.后期讄:

  • 点击Window菜单Q选择Customize Perspective?/SPAN>
  • Submenus栏目下选择New
  • Shortcut Categories下选择Java
  • Shortcuts中在Visual Class前划?/SPAN>
  • Submenus栏目下选择Show View
  • Shortcut Categories下选择Basic
  • Shortcuts中在Palette前划?/SPAN>
  • 通过菜单调出PaletteQ?/SPAN>Window | Show View | Palette
  • ?SPAN lang=EN-US>Menu打开Properties ViewQ?SPAN lang=EN-US style="COLOR: blue">Windows | Show View | Basic | Properties

好了,现在new->Visual Class可以进行GUI的开发了.



ZhuJun 2006-01-02 23:22 发表评论
]]>
[Velocity] Velocity中遇到的一个问?/title><link>http://www.aygfsteel.com/Johncn/archive/2006/01/02/26394.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Mon, 02 Jan 2006 15:18:00 GMT</pubDate><guid>http://www.aygfsteel.com/Johncn/archive/2006/01/02/26394.html</guid><wfw:comment>http://www.aygfsteel.com/Johncn/comments/26394.html</wfw:comment><comments>http://www.aygfsteel.com/Johncn/archive/2006/01/02/26394.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/Johncn/comments/commentRss/26394.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/Johncn/services/trackbacks/26394.html</trackback:ping><description><![CDATA[<FONT face=Arial size=2>在模板中老是讉K不到对象的属?最后发现原来是应ؓ模板中访问的对象不是一个Publicc?<FONT color=#ff3300>Class改ؓPublic</FONT>后一切OK.后来分析可能是因问权限的问题,当Class未加Public?是包内可讉K(friendly),而模板如果与对象的Class不在同一包中时自然访问不? </FONT><img src ="http://www.aygfsteel.com/Johncn/aggbug/26394.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/Johncn/" target="_blank">ZhuJun</a> 2006-01-02 23:18 <a href="http://www.aygfsteel.com/Johncn/archive/2006/01/02/26394.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[Hibernate] 为Hibernate提供JDBCq接http://www.aygfsteel.com/Johncn/archive/2006/01/02/26392.htmlZhuJunZhuJunMon, 02 Jan 2006 15:15:00 GMThttp://www.aygfsteel.com/Johncn/archive/2006/01/02/26392.htmlhttp://www.aygfsteel.com/Johncn/comments/26392.htmlhttp://www.aygfsteel.com/Johncn/archive/2006/01/02/26392.html#Feedback0http://www.aygfsteel.com/Johncn/comments/commentRss/26392.htmlhttp://www.aygfsteel.com/Johncn/services/trackbacks/26392.html可以通过3钟方式ؓHibernate提供JDBCq接:

1.直接提供JDBCq接对象Connection:

Class.forName("com.mysql.jdbc.Driver"); 
String url 
= "jdbc:mysql://localhost:3306/HibernateTest?user=root&password="
java.sql.Connection conn 
= DriverManager.getConnection(url); 
SessionFactory sessionFactory 
= cfg.buildSessionFactory(); 
Session session 
= sessionFactory.openSession(conn);

2.通过属性文?/SPAN>hibernate.properties配置JDBC来源:

hibernate.show_sql = true 
hibernate.dialect 
= net.sf.hibernate.dialect.MySQLDialect 
hibernate.connection.driver_class 
= com.mysql.jdbc.Driver 
hibernate.connection.url 
= jdbc:mysql://localhost/HibernateTest 
hibernate.connection.username = root
hibernate.connection.password 
= 

3.?SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; LETTER-SPACING: 0.75pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-size: 12.0pt">q?/SPAN>XML文ghibernate.cfg.xmlq行配置:

<?xml version='1.0' encoding='big5'?> 
<!DOCTYPE hibernate-configuration 
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" 
    "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd"
> 

<hibernate-configuration> 

    
<session-factory> 

        
<!-- 昄实际操作数据库时的SQL --> 
        
<property name="show_sql">true</property> 
        
<!-- SQL方言Q这边设定的是MySQL --> 
        
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property> 
        
<!-- JDBC驱动E序 --> 
        
<property name="connection.driver_class">com.mysql.jdbc.Driver</property> 
        
<!-- JDBC URL --> 
        
<property name="connection.url">jdbc:mysql://localhost/HibernateTest</property> 
        
<!-- 数据库用?nbsp;--> 
        
<property name="connection.username">caterpillar</property> 
        
<!-- 数据库密?nbsp;--> 
        
<property name="connection.password">123456</property> 

        
<!-- 对象与数据库表格映像文g --> 
        
<mapping resource="User.hbm.xml"/> 
    
</session-factory> 

</hibernate-configuration>


ZhuJun 2006-01-02 23:15 发表评论
]]>
[发掘Jakarta Commons] 使用StringUtilc?/title><link>http://www.aygfsteel.com/Johncn/archive/2005/12/27/25619.html</link><dc:creator>ZhuJun</dc:creator><author>ZhuJun</author><pubDate>Tue, 27 Dec 2005 11:35:00 GMT</pubDate><guid>http://www.aygfsteel.com/Johncn/archive/2005/12/27/25619.html</guid><wfw:comment>http://www.aygfsteel.com/Johncn/comments/25619.html</wfw:comment><comments>http://www.aygfsteel.com/Johncn/archive/2005/12/27/25619.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/Johncn/comments/commentRss/25619.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/Johncn/services/trackbacks/25619.html</trackback:ping><description><![CDATA[<P><FONT face=Arial size=2>org.apache.commons.lang.StringUtils中提供许多有用的字符串操作方法,了解q些ҎQ我们可以避免许多不必要的重复工作。下面介l其中比较有用的几个ҎQ?BR><BR></FONT><STRONG><FONT face=Arial size=2>查空字符Ԍ<BR></FONT></P></STRONG> <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"><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2>StringUtils.isBlank(String str);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>StringUtils.isNotBlank(String str);</FONT></SPAN></DIV> <P><FONT face=Arial><FONT size=2><STRONG>~写字符Ԍ</STRONG><BR></FONT></FONT></P> <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"><FONT face=Arial><FONT size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">String test </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">This is a test of the abbreviation.</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>System.out.println( StringUtils.abbreviate( test, </FONT></SPAN><SPAN style="COLOR: #000000"><FONT face=Arial size=2>10</FONT></SPAN><SPAN style="COLOR: #000000"><FONT face=Arial size=2> ) );<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>[Console输出]<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>This is<IMG src="http://www.aygfsteel.com/images/dot.gif"></FONT></SPAN></DIV><STRONG><FONT face=Arial size=2>查找嵌套字符Ԍ<BR></FONT></STRONG> <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"><FONT face=Arial><FONT size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">String htmlContent </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"><html>\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>                     </FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">  <head>\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>                     </FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">    <title>Test Page</title>\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>                     </FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">  </head>\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>                     </FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">  <body>\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>                     </FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">    <p>This is a TEST!</p>\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>                     </FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">  </body>\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>                     </FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"></html></SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">;<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: #008000">//</SPAN><SPAN style="COLOR: #008000"> Extract the title from this XHTML content </SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">String title </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> StringUtils.substringBetween(htmlContent, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"><title></SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"></title></SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>System.out.println( </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Title: </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2> title );<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>[Console输出]<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>Title: Test Page</FONT></SPAN></DIV><STRONG><FONT face=Arial size=2>验证字符Ԍ<BR></FONT></STRONG> <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"><FONT face=Arial><FONT size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">String test1 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">ORANGE</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">;<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>String test2 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">ICE9</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">;<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>String test3 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">ICE CREAM</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">;<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>String test4 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">820B Judson Avenue</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">;<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><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">boolean</SPAN><SPAN style="COLOR: #000000"> t1val </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> StringUtils.isAlpha( test1 ); </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> returns true</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">boolean</SPAN><SPAN style="COLOR: #000000"> t2val </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> StringUtils.isAlphanumeric( test2 ); </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> returns true</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">boolean</SPAN><SPAN style="COLOR: #000000"> t3val </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> StringUtils.isAlphaSpace( test3 ); </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> returns true</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">boolean</SPAN><SPAN style="COLOR: #000000"> t4val </SPAN><SPAN style="COLOR: #000000">=</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000"> <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>    StringUtils.isAlphanumericSpace( test4 ); </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> returns true</SPAN></FONT></FONT></DIV><FONT face=Arial><FONT size=2><STRONG>计算字符串出现频率:</STRONG>StringUtils.countMatches()</FONT></FONT><A name=jakartackbk-CHP-2-ITERM-2064></A><FONT face=Arial size=2> </FONT><A name=jakartackbk-CHP-2-ITERM-2065></A><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"><FONT face=Arial><FONT size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">File manuscriptFile </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> File(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">manuscript.txt</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000">);<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>Reader reader </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000"> FileReader( manuscriptFile );<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>StringWriter stringWriter </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000"> StringWriter( );<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG id=Codehighlighter1_177_211_Open_Image onclick="this.style.display='none'; Codehighlighter1_177_211_Open_Text.style.display='none'; Codehighlighter1_177_211_Closed_Image.style.display='inline'; Codehighlighter1_177_211_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_177_211_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_177_211_Closed_Text.style.display='none'; Codehighlighter1_177_211_Open_Image.style.display='inline'; Codehighlighter1_177_211_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">( reader.ready( ) ) </SPAN><SPAN id=Codehighlighter1_177_211_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_177_211_Open_Text><SPAN style="COLOR: #000000">{ writer.write( reader.read( ) ); }</SPAN></SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><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>String manuscript </FONT></SPAN><SPAN style="COLOR: #000000"><FONT face=Arial size=2>=</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000"> stringWriter.toString( );<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: #008000">//</SPAN><SPAN style="COLOR: #008000"> Convert string to lowercase</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>manuscript </FONT></SPAN><SPAN style="COLOR: #000000"><FONT face=Arial size=2>=</FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000"> StringUtils.lowerCase(manuscript);<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: #008000">//</SPAN><SPAN style="COLOR: #008000"> count the occurrences of "futility"</SPAN></FONT></FONT><SPAN style="COLOR: #008000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT face=Arial><FONT size=2><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> numFutility </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> StringUtils.countMatches( manuscript, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">futility</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><FONT face=Arial size=2> );<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN></DIV><FONT face=Arial size=2><STRONG>比较不同字符Ԍ<BR></STRONG></FONT> <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"><FONT face=Arial><FONT size=2><STRONG><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></STRONG><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> dist </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> StringUtils.getLevenshteinDistance( </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Word</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">World</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000"> );<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>String diff </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> StringUtils.difference( </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Word</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">World</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000"> );<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: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> index </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> StringUtils.indexOfDifference( </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Word</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">World</SPAN><SPAN style="COLOR: #000000">"</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000"> );<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>System.out.println( </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Edit Distance: </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000"> dist );<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>System.out.println( </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Difference: </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000"> diff );<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>System.out.println( </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Diff Index: </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN style="COLOR: #000000"> index );<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>[Console输出]<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>Edit Distance: </SPAN><SPAN style="COLOR: #000000">2</SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=2><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>Difference: ld<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>Diff Index: </FONT></SPAN><SPAN style="COLOR: #000000"><FONT face=Arial size=2>3</FONT></SPAN></DIV><BR> <HR> <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"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">参考资料:<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>《Jakarta Commons Cookbook?BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>By Timothy M. O'Brien <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>Publisher : O'Reilly <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>Pub Date : November </SPAN><SPAN style="COLOR: #000000">2004</SPAN><SPAN style="COLOR: #000000"> <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>ISBN : </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">596</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">00706</SPAN><SPAN style="COLOR: #000000">-X <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>Pages : </SPAN><SPAN style="COLOR: #000000">400</SPAN><SPAN style="COLOR: #000000"> </SPAN></DIV><img src ="http://www.aygfsteel.com/Johncn/aggbug/25619.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/Johncn/" target="_blank">ZhuJun</a> 2005-12-27 19:35 <a href="http://www.aygfsteel.com/Johncn/archive/2005/12/27/25619.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[HibernateW记] lg(Component)映射http://www.aygfsteel.com/Johncn/archive/2005/12/22/25115.htmlZhuJunZhuJunThu, 22 Dec 2005 10:46:00 GMThttp://www.aygfsteel.com/Johncn/archive/2005/12/22/25115.htmlhttp://www.aygfsteel.com/Johncn/comments/25115.htmlhttp://www.aygfsteel.com/Johncn/archive/2005/12/22/25115.html#Feedback0http://www.aygfsteel.com/Johncn/comments/commentRss/25115.htmlhttp://www.aygfsteel.com/Johncn/services/trackbacks/25115.htmllg(Component)映射多用来表C对象的从属关系(l合,聚合).比如一个学生可能有姓名,q龄,性别,成W{属?其中成W是另一个对?又有U目,分数属?q里需要用lg映射来表是之间的关系.

Java代码:
// 学生
class Student{
  
private
 String name;
  
private int
 age;
  
private
 String sex;
  
private
 Grade grade;

}

// 成W
class Grade{
  
private
 String subject;
  
private float
 score;

}

数据?

-- 学生?/SPAN>
create table STUDENT ( 
    ID 
char(32not null

    NAME 
varchar(16not null

    SEX 
char(1
), 
    AGE 
integer

    
primary key
 (ID) 
);

-- 成W?/SPAN>

create table GRADE ( 
    ID 
char(32not null

    student_id 
char(32not null

    SUBJECT 
varchar(10
), 
    SCORE 
float

    
primary key
 (ID),
    
foreign key
 (student_id) 
);

Hibernate映射文g:
<?xml version="1.0"?> 
<!
DOCTYPE hibernate-mapping 
    PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" 
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"
>
 
<hibernate-mapping>
 
    
<class name="Student" table="STUDENT">
 

            
<id name="id" type="string" unsaved-value="null">
 
            
<column name="ID" sql-type="char(32)"/>
 
            
<generator class="uuid.hex"/>
 
        
</id>
 

        
<property name="name" type="string" not-null="true">
 
            
<column name="NAME" length="16" not-null="true"/>
 
        
</property>
 
        
<property name="sex" type="char" column="SEX"/>
 
        
<property name="age" type="int" column="AGE"/>
 
        
        
<component name="grade" class="Grade">
 
            
<property name="subject" type="string" column="SUBJECT" not-null="true"/>
 
            
<property name="score" type="float" column="SCORE" not-null="true"/>
 
        
</component>
 

    
</class>
 
</hibernate-mapping>


ZhuJun 2005-12-22 18:46 发表评论
]]>[发掘Jakarta Commons] 使用LRUMap http://www.aygfsteel.com/Johncn/archive/2005/12/15/24088.htmlZhuJunZhuJunThu, 15 Dec 2005 11:59:00 GMThttp://www.aygfsteel.com/Johncn/archive/2005/12/15/24088.htmlhttp://www.aygfsteel.com/Johncn/comments/24088.htmlhttp://www.aygfsteel.com/Johncn/archive/2005/12/15/24088.html#Feedback0http://www.aygfsteel.com/Johncn/comments/commentRss/24088.htmlhttp://www.aygfsteel.com/Johncn/services/trackbacks/24088.htmlLRUMap(Least Recently Used Cache)可用来保存最q用的几条记录,例如:保存Blog中的最q?0条留a.大多数情는作缓??EHCache)的一U策?具体使用Ҏ如下:
import java.util.Map;
import
 org.apache.commons.collections.map.LRUMap;

cache 
= new LRUMap( 5
 );     

// Populate the cache with 5 stock prices

cache.put( "MSFT"new Float( 0.03 ) );
cache.put( 
"TSC"new Float( 0.001
 ) );
cache.put( 
"LU"new Float( 23.30
 ) );
cache.put( 
"CSCO"new Float( 242.20
 ) );
cache.put( 
"P"new Float( 10.23
 ) );
     
// Now use some of the entries in the cache

Float cscoPrice  = (Float) cache.get( "CSCO" );
Float msPrice 
= (Float) cache.get( "MSFT"
 );
Float tscPrice 
= (Float) cache.get( "TSC"
 );
Float luPrice 
= (Float) cache.get( "LU"
 );
Float pPrice 
= (Float) cache.get( "P"
 );
Float msPrice2 
= (Float) cache.get( "MSFT"
 );
  
// Add another price to the Map, this should kick out the LRU item.

cache.put( "AA"new Float( 203.20 ) );
此时,~存中的元素?
[CSCO]
[MSFT]
[TSC]
[LU]
[P]
[AA]
׃LRU最q没有被讉K,所以当AA加入?׃过了缓存的最大容?5),所以被剔除了缓?


参考资?
<<
Jakarta Commons Cookbook>>
 
By Timothy M. O
'Brien 

   
Publisher : O
'Reilly 

Pub Date : November 2004 
ISBN : 
0-596-00706-

Pages : 
400
 


ZhuJun 2005-12-15 19:59 发表评论
]]>[HibernateW记] l承映射http://www.aygfsteel.com/Johncn/archive/2005/09/11/12645.htmlZhuJunZhuJunSat, 10 Sep 2005 16:21:00 GMThttp://www.aygfsteel.com/Johncn/archive/2005/09/11/12645.htmlhttp://www.aygfsteel.com/Johncn/comments/12645.htmlhttp://www.aygfsteel.com/Johncn/archive/2005/09/11/12645.html#Feedback0http://www.aygfsteel.com/Johncn/comments/commentRss/12645.htmlhttp://www.aygfsteel.com/Johncn/services/trackbacks/12645.html对于对象的承关p? “每一늱l承树对应一个表?卛_每一个子c都q行使用<subclass>声明?例如:

有一个基c? class User, 两个子类: class Admin?class Guest.

则新Z个表格来对应q个l承cL:

create table USER ( 
    ID 
char(32not null
    DISCRIMINATOR_USERTYPE 
varchar(255not null
    NAME 
varchar(16not null
    PASSWORD 
varchar(16not null
    USER_LEVEL 
integer
    POWER_OTHER 
varchar(255), 
    GUEST_OTHER 
varchar(255), 
    
primary key (ID) 
);

其中字段DISCRIMINATOR_USERTYPE来记录储存的cd是属?/SPAN>User?/SPAN>Admin或是Guest的记录,如果该字D|ParentUserQ则表示该笔数据?/SPAN>UsercdQ如果是ADMINQ表C是Admin的记录,如果?/SPAN>GUESTQ表C是Guest的记?


映像文g:

<?xml version="1.0"?> 
<!DOCTYPE hibernate-mapping 
    PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" 
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"
> 

<hibernate-mapping> 

    
<class name="com.zj.User" table="USER" discriminator-value="ParentUser"> 

        
<id name="id" type="string" unsaved-value="null"> 
            
<column name="ID" sql-type="char(32)"/> 
            
<generator class="uuid.hex"/> 
        
</id> 

        
<discriminator column="DISCRIMINATOR_USERTYPE" type="string"/> 

        
<property name="name" type="string" not-null="true"> 
            
<column name="NAME" length="16" not-null="true"/> 
        
</property> 

        
<property name="password" type="string" not-null="true"> 
            
<column name="PASSWORD" length="16" not-null="true"/> 
        
</property> 

        
<subclass name="com.zj.Admin" discriminator-value="ADMIN"> 
            
<property name="level" type="integer" column="ADMIN_LEVEL"/> 

            
<property name="otherOfPower" type="string" column="POWER_OTHER"/> 
         
</subclass> 
        
         
<subclass name="com.zj.Guest" discriminator-value="GUEST"> 
            
<property name="otherOfGuest" type="string" column="GUEST_OTHER"/> 
         
</subclass> 
    
</class> 

</hibernate-mapping>


注意上面文g?在映像子cdӞ使用<subclass>指明映像的子cd以及?/SPAN>discriminator-value来指?

ZhuJun 2005-09-11 00:21 发表评论
]]>
վ֩ģ壺 | ȷɽ| | ʶ| | ˮ| | | ɽ| ¡| ͼ| | | | | ǫ| Ͻ| ν| ֦| | | | ǿ| | | | | Һ| Ƕ| | ͷ| ɽ| | ̳| | ƽ| Ƥ| »| | | |