JSP/JAVA ±à³Ì²Î¿¼
µÚ1Ìõ How to Write an Equality Method in Java
http://www.artima.com/lejava/articles/equality.html
How to Write an Equality Method in Java
by Martin Odersky, Lex Spoon, and Bill Venners
June 1, 2009
Summary
This article describes a technique for overriding the equals method that preserves the contract of equals even when subclassses of concrete classes add new fields.
In Item 8 of Effective Java1, Josh Bloch describes the difficulty of preserving the equals contract when subclassing as a “fundamental problem of equivalence relations in object-oriented languages.” Bloch writes:
There is no way to extend an instantiable class and add a value component while preserving the equals contract, unless you are willing to forgo the benefits of object-oriented abstraction.
Chapter 28 of Programming in Scala shows an approach that allows subclasses to extend an instantiable class, add a value component, and nevertheless preserve the equals contract. Although in the technique is described in the book in the context of defining Scala classes, it is also applicable to classes defined in Java. In this article, we present the technique using text adapted from the relevant section of Programming in Scala, but with the code examples translated from Scala into Java.
µÚ2Ìõ jspʹÓÃURL±àÂë´«µÝÖÐÎIJÎÊýÎÊÌâ
http://blog.csdn.net/jxcjxinxing/archive/2007/12/30/1469924.aspx
JspÒ³ÃæʹÓÃURL±àÂë´«µÝÖÐÎIJÎÊýµÄÇé¿öÏ£¬ÔÚ²ÎÊýµÄ½âÎö¹ý³ÌÖлá³öÏÖÂÒÂë¡£ÓÉÓÚjavaÔÚÉè¼ÆµÄʱºò¿¼Âǵ½Á˹ú¼Ê»¯µÄÎÊÌ⣬ÔÚjavaÔ´³ÌÐò±àÒë³É×Ö½ÚÂëµÄʱºòĬÈÏʹÓõÄÊÇUTF-8±àÂë¡£¶øÔÚwebÔËÓÃÉÏ£¬ÓÉÓÚ²»Í¬µÄä¯ÀÀÆ÷Ïò·þÎñÆ÷·¢Ë͵ÄÐÅÏ¢²ÉÓõıàÂ뷽ʽ²»Í¬£¬ÔÚÓÉÏñtomcatÖ®ÀàµÄ·þÎñÆ÷½âÂëµÄʱºò»áÓÉÓÚ±àÂ뷽ʽµÄ²»Í¬¶ø²úÉúÂÒÂ룬ÕâÊÇÒ»¸ö»áÀ§ÈÅjsp³õѧÕߺܾõÄÎÊÌâ¡£
¾ÙÀý˵Ã÷£º
String sContent = "ÖÐÎÄ ²ÎÊý";
Èç¹û²»×öÈκδ¦Àí¾ÍÖ±½Ó´«µÝ£¬ÖÐÎÄÒ²ÐíûÓÐÎÊÌ⣨µ«²»±£Ö¤£©£¬µ«¿Õ¸ñ¿Ï¶¨»áÓÐÎÊÌ⣬µ½½ÓÊÕÒ³ÃæÎÞ·¨Ê¶±ð¡£
½â¾ö°ì·¨1£º
java.net.URLEncoder.encode(sContent,"gb2312"); È»ºóÔÙ
Ïà¹ØÎĵµ£º
¼ÙÉèÐèÇó(ÈçÓÐÀ×ͬ£¬´¿ÊôÇɺÏ)£º
ÓÐÒ»¸öÈ«¹úÐԵĴóÆóÒµ£¬ÔÚÈ«¹ú¸÷µØÐèÒª²¿ÊðÉÏǧ̨¿Í»§»ú£¬ÕâЩ¿Í»§»úÐèҪʵʱÓë·þÎñÆ÷½»»¥£¬½øÐÐÊý¾Ý´¦Àí¡£ÊµÊ±ÐÔÒªÇó¸ß£¬°²È«ÐԸߣ¬ÒªÇóÖ§³ÖÊÂÎñ£¬ÒÔ¼°²»ÖжϷþÎñ¡£
Ó²¼þ²¿Êð£º
1¡¢ 3000̨¿Í»§»ú
2¡¢ 10̨· ......
Èç¹û¶ÔÊý¾Ý¿â½øÐжà´Î²Ù×÷,ÿһ´ÎµÄÖ´Ðлò²½Ö趼ÊÇÒ»¸öÊÂÎñ.Èç¹ûÊý¾Ý¿â²Ù×÷ÔÚijһ²½Ã»ÓÐÖ´Ðлò³öÏÖÒì³£¶øµ¼ÖÂÊÂÎñʧ°Ü,ÕâÑùÓеÄÊÂÎñ±»Ö´ÐÐÓеľÍûÓб»Ö´ÐÐ,´Ó¶ø¾ÍÓÐÁËÊÂÎñµÄ»Ø¹ö,È¡ÏûÏÈÇ°µÄ²Ù×÷.....
JavaBeanÖÐʹÓÃJDBC·½Ê½½øÐÐÊÂÎñ´¦Àí
public int delete(int sID) {
¡¡ dbc = new DataBaseConnection();
¡¡ Connect ......
Java ÖÐµÄ keytool.exe £¨Î»ÓÚ JDK\Bin Ŀ¼Ï£©¿ÉÒÔÓÃÀ´´´½¨Êý×ÖÖ¤Ê飬ËùÓеÄÊý×ÖÖ¤ÊéÊÇÒÔÒ»ÌõÒ»Ìõ(²ÉÓñðÃûÇø±ð)µÄÐÎʽ´æÈëÖ¤Êé¿âµÄÖУ¬Ö¤Êé¿âÖеÄÒ»ÌõÖ¤Êé°üº¬¸ÃÌõÖ¤ÊéµÄ˽Կ£¬¹«Ô¿ºÍ¶ÔÓ¦µÄÊý×ÖÖ¤ÊéµÄÐÅÏ¢¡£Ö¤Êé¿âÖеÄÒ»ÌõÖ¤Êé¿ÉÒÔµ¼³öÊý×ÖÖ¤ÊéÎļþ£¬Êý×ÖÖ¤ÊéÎļþÖ»°üÀ¨Ö÷ÌåÐÅÏ¢ºÍ¶ÔÓ¦µÄ¹«Ô¿¡£
KeytoolÊÇÒ»¸öJavaÊý¾ÝÖ ......
import java.io.*;
public class Test {
public static String convert(String s) {
if (s == null || s.length() == 0)
return s;
  ......