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");
Ïà¹ØÎĵµ£º
¡¡1¡¢FACTORY—×·MMÉÙ²»ÁËÇë³Ô·¹ÁË£¬Âóµ±À͵靈áºÍ¿ÏµÂ»ùµÄ¼¦³á¶¼ÊÇMM°®³ÔµÄ¶«Î÷£¬ËäÈ»¿ÚζÓÐËù²»Í¬£¬µ«²»¹ÜÄã´øMMÈ¥Âóµ±ÀÍ»ò¿ÏµÂ»ù£¬Ö»¹ÜÏò·þÎñԱ˵“À´Ëĸö¼¦³á”¾ÍÐÐÁË¡£Âóµ±ÀͺͿϵ»ù¾ÍÊÇÉú²ú¼¦³áµÄFactory
¡¡¡¡¹¤³§Ä£Ê½£º¿Í»§ÀàºÍ¹¤³§Àà·Ö¿ª¡£Ïû·ÑÕßÈκÎʱºòÐèҪijÖÖ²úÆ·£¬Ö»ÐèÏò¹¤³§ÇëÇó¼´¿É¡£Ïû· ......
±¾ÎĵÄÄ¿±êÊÇÉè¼ÆÒ»¸ö»ùÓÚSwingµÄJTextAreaÏÔʾ¿ØÖÆÌ¨Êä³ö¡£´ËÆÚ¼ä£¬ÎÒÃÇ»¹½«ÌÖÂÛһЩºÍJava¹ÜµÀÁ÷£¨PipedInputStreamºÍPipedOutputStream£©ÓйصÄ×¢ÒâÊÂÏî¡£×îºó»¹Òª´´½¨Ò»¸öÄܹ»²¶»ñºÍÏÔʾÆäËû³ÌÐò£¨¿ÉÒÔÊÇ·ÇJavaµÄ³ÌÐò£©¿ØÖÆÌ¨Êä³öµÄ¼òµ¥³ÌÐò¡£
Ò»¡¢Java¹ÜµÀÁ÷
ÒªÔÚÎı¾ ......
Ò»¡¢UTF8ת»»³ÉGB2312
µ±ÎÒÃÇÔÚ»ùÓÚHTTPÐÒéµÄJSP»òServletµÄÓ¦ÓÃÖлñÈ¡Êý¾Ý»ò·¢ËÍÇëÇóʱ£¬JVM»á°ÑÊäË͵ÄÊý¾Ý±àÂë³ÉUTF8¸ñʽ¡£Èç¹ûÎÒÃÇÖ±½Ó´ÓHTTPÁ÷ÖÐÌáÈ¡ÖÐÎÄÊý¾Ý£¬ÌáÈ¡µÄ½á¹ûΪ“????”£¨¿ÉÄܸü¶àÎʺţ©£¬Îª×ª»»³ÉÎÒÃÇÄܹ»Àí½âµÄÖÐÎÄ×Ö·û£¬ÎÒÃÇÐèÒª°ÑUTF8ת»»³É ......
Á½ÖÖ½¨Á¢Ï̶߳ÔÏóµÄ·½·¨£º
Extends Thread
implement Runnable
ÕâÁ½ÖÖ·½·¨¶¼¿ÉÒÔ´´½¨Ò»¸öÏ̶߳ÔÏó£¬
public class TestThread {
public static void main(String arg[]){
newThread thread = new ne ......
ÒÔÏÂÊǶÔJAVAÒì³£µÄ¼Ì³Ð»úÖÆµÄһЩ×ܽᡣ
1. RuntimeExceptionÓëException, Error²»Í¬µã£º µ±·½·¨ÌåÖÐÅ׳ö·ÇRuntimeException£¨¼°Æä×ÓÀࣩʱ£¬·½·¨Ãû±ØÐëÉùÃ÷Å׳öµÄÒì³££»µ«Êǵ±·½·¨ÌåÖÐÅ׳öRuntimeException£¨°üÀ¨RuntimeException×ÓÀࣩʱ£¬·½·¨Ãû²»±ØÉùÃ÷¸Ã¿ÉÄܱ»Å׳öµÄÒì³££¬¼´Ê¹ÉùÃ÷ÁË£¬JAVA³ÌÐòÔÚij¸öµ÷Óõĵط½£¬Ò² ......