java servlet ÂÒÂë
javaдÎļþÂÒÂë
StringBuffer sb = new StringBuffer();
sb.append("<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"b5d6e6\"");
sb.append("<tr>");
sb.append("<td bgcolor=\"#FFFFFE\" height=\"42\" colspan=\""+ (jsd.size()+1) +"\" align=\"center\"><b>" + dataSet.getTitle() + "</b></td>");
sb.append("</tr>");
sb.append("</tr>");
sb.append("</table>");
return sb.toString();
½â¾ö·½·¨
ʹÓÃ
public static String ISOToInnerCode(String str) {
if (str == null)
return null;
try {
str = (new String(str.getBytes("ISO-8859-1"), "UTF-8")).trim();
} catch (Exception ex) {
}
return str;
}
ÈôÊÇÔÚservletÖÐÔòʹÓÃ
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
PrintWrite out=response.getWrite();
Èç¹ûÊÇ
OutputStream out = response.getOutputStream();
Êä³öʱÓÃout.write(Content.getBytes("utf-8"));¼´Ôö¼ÓÒ»ÖÖ±àÂë utf-8Ò²¿É¸Ä³ÉÆäËû±àÂëgbk,gb2312µÈ ÒÀ×Ô¼ºÇé¿ö¶ø¶¨
Èç¹û½ÓÊÜ´«²ÎÊýʱÂÒÂë Ö»Ðè°Ñ response.setContentType("text/html;charset=utf-8");
¸Ä³Éresponse.setCharacterEncoding("UTF-8");
Ïà¹ØÎĵµ£º
±¾ÎĵÄÄ¿±êÊÇÉè¼ÆÒ»¸ö»ùÓÚSwingµÄJTextAreaÏÔʾ¿ØÖÆÌ¨Êä³ö¡£´ËÆÚ¼ä£¬ÎÒÃÇ»¹½«ÌÖÂÛһЩºÍJava¹ÜµÀÁ÷£¨PipedInputStreamºÍPipedOutputStream£©ÓйصÄ×¢ÒâÊÂÏî¡£×îºó»¹Òª´´½¨Ò»¸öÄܹ»²¶»ñºÍÏÔʾÆäËû³ÌÐò£¨¿ÉÒÔÊÇ·ÇJavaµÄ³ÌÐò£©¿ØÖÆÌ¨Êä³öµÄ¼òµ¥³ÌÐò¡£
Ò»¡¢Java¹ÜµÀÁ÷
ÒªÔÚÎı¾ ......
1.java static inner class ºÍ non-static inner classµÄÇø±ð?
2.Çëд³öÒ»¸ösingletonģʽµÄclass.
ÄãÈç¹ûд³öÏÂÃæµÄ2ÖÖÑùʽ,ÎÒ»áÎÊÄã:ÇëÎÊÄãÈçºÎÔÚͬһ¸öjvmÖв¢ÇÒÔÚͬһ¸öclassLoaderÖеõ½ËüµÄ¶à¸öʵÀý?(Çë²»ÒªÆæ¹Ö)
ÑùÁÐ1:
public class Singleton {
private final static Singleton instance= ......
ÒÔÏÂÊǶÔJAVAÒì³£µÄ¼Ì³Ð»úÖÆµÄһЩ×ܽᡣ
1. RuntimeExceptionÓëException, Error²»Í¬µã£º µ±·½·¨ÌåÖÐÅ׳ö·ÇRuntimeException£¨¼°Æä×ÓÀࣩʱ£¬·½·¨Ãû±ØÐëÉùÃ÷Å׳öµÄÒì³££»µ«Êǵ±·½·¨ÌåÖÐÅ׳öRuntimeException£¨°üÀ¨RuntimeException×ÓÀࣩʱ£¬·½·¨Ãû²»±ØÉùÃ÷¸Ã¿ÉÄܱ»Å׳öµÄÒì³££¬¼´Ê¹ÉùÃ÷ÁË£¬JAVA³ÌÐòÔÚij¸öµ÷Óõĵط½£¬Ò² ......
·ºÐÍÊÇJava SE 1.5µÄÐÂÌØÐÔ£¬·ºÐ͵ı¾ÖÊÊDzÎÊý»¯ÀàÐÍ£¬Ò²¾ÍÊÇ˵Ëù²Ù×÷µÄÊý¾ÝÀàÐͱ»Ö¸¶¨ÎªÒ»¸ö²ÎÊý¡£ÕâÖÖ²ÎÊýÀàÐÍ¿ÉÒÔÓÃÔÚÀà¡¢½Ó¿ÚºÍ·½·¨µÄ´´½¨ÖУ¬·Ö±ð³ÆÎª·ºÐÍÀà¡¢·ºÐͽӿڡ¢·ºÐÍ·½·¨¡£
¡¡¡¡JavaÓïÑÔÒýÈë·ºÐ͵ĺô¦Êǰ²È«¼òµ¥¡£
¡¡¡¡ÔÚJava SE 1.5֮ǰ£¬Ã»ÓзºÐ͵ÄÇé¿öµÄÏ£¬Í¨¹ý¶ÔÀàÐÍObjectµÄÒýÓÃÀ´ÊµÏÖ²ÎÊýµÄ“È ......
Ä¿Ç°ÍøÂçÉϹØÓÚ¶ÔÏóÐòÁл¯µÄÎÄÕ²»ÉÙ£¬µ«ÊÇÎÒ·¢ÏÖÏêϸÐðÊöÓ÷¨ºÍÔÀíµÄÎÄÕÂÌ«ÉÙ¡£±¾È˰Ñ×Ô¼º¾¹ý¾Ñé×ܽáºÍʵ¼ÊÔËÓÃÖеÄÌå»áд³ÉµÄѧϰ±Ê¼Ç¹±Ï׸ø´ó¼Ò¡£Ï£ÍûÄÜΪÕû¸öjavaÉçÇøµÄ·±ÈÙ×öÒ»µãÊÂÇé¡£
¡¡¡¡ÐòÁл¯µÄ¹ý³Ì¾ÍÊǶÔÏóдÈë×Ö½ÚÁ÷ºÍ´Ó×Ö½ÚÁ÷ÖжÁÈ¡¶ÔÏó¡£½«¶ÔÏó״̬ת»»³É×Ö½ÚÁ÷Ö®ºó£¬¿ÉÒÔÓÃjava.io°üÖеĸ÷ÖÖ×Ö½ÚÁ÷Àà½«Æ ......