jspÂÒÂë½â¾ö
GBK±àÂë
GBK±àÂëÊÇÖйúÖƶ©µÄ¡¢µÈͬÓÚUCSµÄеÄÖÐÎıàÂëÀ©Õ¹¹ú¼Ò±ê×¼¡£GBK¹¤×÷С×éÓÚ1995Äê10Ô£¬Í¬Äê12ÔÂÍê³ÉGBK¹æ·¶¡£¸Ã±àÂë±ê×¼¼æÈÝGB2312£¬¹²ÊÕ¼ºº×Ö21003¸ö¡¢·ûºÅ883¸ö£¬²¢Ìṩ1894¸öÔì×ÖÂë룬¼ò¡¢·±Ìå×ÖÈÚÓÚÒ»¿â¡£
UTF-8±àÂë
UTF-8±àÂë¿ÉÒÔͨ¹ýÆÁ±ÎλºÍÒÆλ²Ù×÷¿ìËÙ¶Áд¡£×Ö·û´®±È½Ïʱstrcmp()ºÍ
wcscmp()µÄ·µ»Ø½á¹ûÏàͬ£¬Òò´ËʹÅÅÐò±äµÃ¸ü¼ÓÈÝÒס£×Ö½ÚFFºÍFEÔÚUTF-8±àÂëÖÐÓÀÔ¶²»»á³öÏÖ£¬Òò´ËËûÃÇ¿ÉÒÔÓÃÀ´±íÃ÷UTF-16»òUTF-
32Îı¾£¨¼ûBOM£© UTF-8 ÊÇ×Ö½Ú˳ÐòÎ޹صġ£ËüµÄ×Ö½Ú˳ÐòÔÚËùÓÐϵͳÖж¼ÊÇÒ»ÑùµÄ£¬Òò´ËËüʵ¼ÊÉϲ¢²»ÐèÒªBOM¡£
GB2312
GB2312Ö§³ÖµÄºº×ÖÌ«ÉÙ¡£1995ÄêµÄºº×ÖÀ©Õ¹¹æ·¶GBK1.0ÊÕ¼ÁË21886¸ö·û
ºÅ£¬Ëü·ÖΪºº×ÖÇøºÍͼÐηûºÅÇø¡£ºº×ÖÇø°üÀ¨21003¸ö×Ö·û¡£2000ÄêµÄGB18030ÊÇÈ¡´úGBK1.0µÄÕýʽ¹ú¼Ò±ê×¼¡£¸Ã±ê×¼ÊÕ¼ÁË27484¸öºº
×Ö£¬Í¬Ê±»¹ÊÕ¼Á˲ØÎÄ¡¢ÃÉÎÄ¡¢Î¬Îá¶ûÎĵÈÖ÷ÒªµÄÉÙÊýÃñ×åÎÄ×Ö¡£ÏÖÔÚµÄPCƽ̨±ØÐëÖ§³ÖGB18030£¬¶ÔǶÈëʽ²úÆ·Ôݲ»×÷ÒªÇó¡£ËùÒÔÊÖ»ú¡¢MP3Ò»°ãÖ»Ö§
³ÖGB2312¡£
´ÓASCII¡¢GB2312¡¢GBKµ½GB18030£¬ÕâЩ±àÂë·½·¨ÊÇÏòϼæÈݵģ¬¼´Í¬Ò»¸ö
×Ö·ûÔÚÕâЩ·½°¸ÖÐ×ÜÊÇÓÐÏàͬµÄ±àÂ룬ºóÃæµÄ±ê×¼Ö§³Ö¸ü¶àµÄ×Ö·û¡£ÔÚÕâЩ±àÂëÖУ¬Ó¢ÎĺÍÖÐÎÄ¿ÉÒÔͳһµØ´¦Àí¡£Çø·ÖÖÐÎıàÂëµÄ·½·¨ÊǸß×Ö½ÚµÄ×î¸ßλ²»Îª0¡£°´
ÕÕ³ÌÐòÔ±µÄ³Æºô£¬GB2312¡¢GBKµ½GB18030¶¼ÊôÓÚË«×Ö½Ú×Ö·û¼¯ (DBCS)¡£
Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
¶þ¡¢±íµ¥Ìá½»ÖÐÎÄʱ³öÏÖÂÒÂë
Èý¡¢Êý¾Ý¿âÁ¬½Ó
´ó¼ÒÔÚJSPµÄ¿ª·¢¹ý³ÌÖУ¬¾³£³öÏÖÖÐÎÄÂÒÂëµÄÎÊÌ⣬¿ÉÄÜÒ»ÖÁÀ§ÈÅ×ÅÄú£¬ÎÒÏÖÔÚ°ÑÎÒÔÚJSP¿ª·¢ÖÐÓöµ½
µÄÖÐÎÄÂÒÂëµÄÎÊÌâ¼°½â¾ö°ì·¨Ð´³öÀ´¹©´ó¼Ò²Î¿¼¡£
Ò»¡¢JSPÒ³ÃæÏÔʾÂÒÂë
ÏÂÃæµÄÏÔʾҳÃæ(display.jsp)¾Í³öÏÖÂÒÂ룺
¶Ô²»Í¬µÄWEB·þÎñÆ÷ºÍ²»Í¬µÄJDK°æ±¾£¬´¦Àí½á¹û¾Í²»Ò»Ñù¡£ÔÒò£º·þÎñÆ÷ʹÓõıàÂ뷽ʽ²»Í¬ºÍä¯ÀÀÆ÷
<html>
<head>
<title>JSPµÄÖÐÎÄ´¦Àí</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
out.print("JSPµÄÖÐÎÄ´¦Àí");
%>
</body>
</html>
¶Ô²»Í¬µÄ×Ö·ûÏÔʾ½á¹û²»Í¬¶øµ¼Öµġ£½â¾ö°ì·¨£ºÔÚJSPÒ³ÃæÖÐÖ¸¶¨±àÂ뷽ʽ(gb2312),¼´ÔÚÒ³ÃæµÄµÚÒ»
ÐмÓÉÏ£º
<%@ page contentType="text/html; charset=gb2312"%>
¾Í¿ÉÒÔÏû³ýÂÒÂëÁË¡£ÍêÕûÒ³ÃæÈçÏ£º
<%@ page contentType="text/
Ïà¹ØÎĵµ£º
ÑéÖ¤ÂëµÄÉú³É˼ÏëÊÇÔÚ·þÎñÆ÷¶ÎÔ¤ÏÈÉú³ÉºÃÑéÖ¤Â룬ǰ̨ÏÔʾ£¬È»ºóÔÙµ½ºǫ́ȥƥÅ䣡
code.jsp:
<%@ page language="java" import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*"
contentType="image/jpeg" pageEncoding="UTF-8"%>
<% //ÉèÖÃÒ³Ãæ²»» ......
1¡¢jspÒ³ÃæÂÒÂ룺
ÔÚjspÒ³Ã濪ʼÌí¼Ó<%pageEncoding="uft-8"%>
2¡¢servletÊä³öÂÒÂ룺
ÔÚÊä³öÄÚÈÝ֮ǰ£¬ÏÈÖ´ÐÐresponse.setContentType
("text/html;charset=utf-8")
3¡¢ÔÚformÀïÓÃpost·½Ê½Ìá½»²ÎÊý£º
1£©½ÓÊÕʱ¼Órequest.setCharacterEncoding("utf-8")
2£©Ê¹ÓùýÂËÆ÷£¬ÔÚ½ÓÊÕ²ÎÊý֮ǰ£¬É趨´«µÝµÄ²ÎÊýÄ ......
goodsbean.java
package sale;
public class goodsbean{
String Product;
double Price;
public goodsbean (){
this.Product = "box";
this.Price = 5.0;
}
public void setProduct (String ......
private String projectName="sz_pro"; // ÄãÏîÄ¿µÄÃû³Æ
//»ñÈ¡µ±Ç°ÏîÄ¿µÄ¾ø¶Ô·¾¶
public String getPorjectPath(){
String nowpath; //µ±Ç°tomcatµÄbi ......
JSP²ÊÉ«ÑéÖ¤Âë
Éú³ÉÓÐ4¸öËæ»úÊý×ÖºÍÔÓÂÒ±³¾°µÄͼƬ£¬Êý×ֺͱ³¾°ÑÕÉ«»á¸Ä±ä£¬·þÎñÆ÷¶ËˢУ¨ÓÃhistory.go(-1)Ò²»á±ä£©
ÔÐͲο¼ALIBABA http://china.alibaba.com/member/showimage
²úÉúÑéÖ¤ÂëͼƬµÄÎļþ-----image.jsp
<%@ page contentType="image/jpeg" import="java.awt.*,java.awt.image.*,java.util.*,java ......