Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JspÂÒÂëÎÊÌâµÄ½â¾ö

×î»ù±¾µÄÂÒÂëÎÊÌâ
Õâ¸öÂÒÂëÎÊÌâÊÇ×î¼òµ¥µÄÂÒÂëÎÊÌâ¡£Ò»°ãлá³öÏÖ¡£¾ÍÊÇÒ³Ãæ±àÂë²»Ò»Öµ¼ÖµÄÂÒÂë¡£
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=iso8859-1"%>
<html>
<head>
<title>ÖÐÎÄÎÊÌâ</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
</head>
<body>
ÎÒÊǸöºÃÈË
</body>
</html>
Èý¸öµØ·½µÄ±àÂë¡£
µÚÒ»¸öµØ·½µÄ±àÂë¸ñʽΪjspÎļþµÄ´æ´¢¸ñʽ¡£Eclipse»á¸ù¾ÝÕâ¸ö±àÂë¸ñʽ±£´æÎļþ¡£²¢±àÒëjspÎļþ£¬°üÀ¨ÀïÃæµÄºº×Ö¡£
µÚ¶þ´¦±àÂëΪ½âÂë¸ñʽ¡£ÒòΪ´æΪUTF-8µÄÎļþ±»½âÂëΪiso8859-1£¬ÕâÑù ÈçÓÐÖÐÎĿ϶¨³öÂÒÂë¡£Ò²¾ÍÊDZØÐëÒ»Ö¡£¶øµÚ¶þ´¦ËùÔÚµÄÕâÒ»ÐУ¬¿ÉÒÔûÓС£È±Ê¡Ò²ÊÇʹÓÃiso8859-1µÄ±àÂë¸ñʽ¡£ËùÒÔÈç¹ûûÓÐÕâÒ»ÐеĻ°£¬“ÎÒÊǸöºÃÈ˔Ҳ»á³öÏÖÂÒÂë¡£±ØÐëÒ»Ö²ſÉÒÔ¡£
µÚÈý´¦±àÂëΪ¿ØÖÆä¯ÀÀÆ÷µÄ½âÂ뷽ʽ¡£Èç¹ûÇ°ÃæµÄ½âÂ붼һÖ²¢ÇÒÎÞÎóµÄ»°£¬Õâ¸ö±àÂë¸ñʽûÓйØϵ¡£ÓеÄÍøÒ³³öÏÖÂÒÂ룬¾ÍÊÇÒòΪä¯ÀÀÆ÷²»ÄÜÈ·¶¨Ê¹ÓÃÄÄÖÖ±àÂë¸ñʽ¡£ÒòΪҳÃæÓÐʱºò»áǶÈëÒ³Ã棬µ¼ÖÂä¯ÀÀÆ÷»ìÏýÁ˱àÂë¸ñʽ¡£³öÏÖÁËÂÒÂë¡£
±íµ¥Ê¹ÓÃPost·½Ê½Ìá½»ºó½ÓÊÕµ½µÄÂÒÂëÎÊÌâ
Õâ¸öÎÊÌâÒ²ÊÇÒ»¸ö³£¼ûµÄÎÊÌâ¡£Õâ¸öÂÒÂëÒ²ÊÇtomcatµÄÄÚ²¿±àÂë¸ñʽiso8859-1ÔÚµ·ÂÒ£¬Ò²¾ÍÊÇ˵postÌύʱ£¬Èç¹ûûÓÐÉèÖÃÌá½»µÄ±àÂë¸ñʽ£¬Ôò»áÒÔiso8859-1·½Ê½½øÐÐÌá½»£¬½ÓÊܵÄjspÈ´ÒÔutf-8µÄ·½Ê½½ÓÊÜ¡£µ¼ÖÂÂÒÂë¡£¼ÈÈ»ÕâÑùµÄÔ­Òò£¬ÏÂÃæÓм¸ÖÖ½â¾ö·½Ê½£¬²¢±È½Ï¡£
A ½ÓÊܲÎÊýʱ½øÐбàÂëת»»
String str = new String(request.getParameter("something").getBytes("ISO-8859-1"),"utf-8") ;ÕâÑùµÄ»°£¬Ã¿Ò»¸ö²ÎÊý¶¼±ØÐëÕâÑù½øÐÐתÂë¡£ºÜÂé·³¡£µ«È·Êµ¿ÉÒÔÄõ½ºº×Ö¡£
B ÔÚÇëÇóÒ³ÃæÉÏ¿ªÊ¼´¦£¬Ö´ÐÐÇëÇóµÄ±àÂë´úÂ룬 request.setCharacterEncoding("UTF-8")£¬°ÑÌá½»ÄÚÈݵÄ×Ö·û¼¯ÉèΪUTF£­8¡£ÕâÑùµÄ»°£¬½ÓÊܴ˲ÎÊýµÄÒ³Ãæ¾Í²»±ØÔÚתÂëÁË¡£Ö±½ÓʹÓÃ
String str = request.getParameter("something")£»¼´¿ÉµÃµ½ºº×Ö²ÎÊý¡£µ«Ã¿Ò³¶¼ÐèÒªÖ´ÐÐÕâ¾ä»°¡£Õâ¸ö·½·¨Ò²¾Í¶ÔpostÌá½»µÄÓÐЧ¹û£¬¶ÔÓÚgetÌá½»ºÍÉÏ´«Îļþʱenctype="multipart/form-data"ÊÇÎÞЧµÄ¡£ÉÔºóÏÂÃæµ¥¶À¶ÔÕâ¸öÁ½¸öµÄÂÒÂëÇé¿öÔÙ½øÐÐ˵Ã÷¡£
C ΪÁ˱ÜÃâÿҳ¶¼ÒªÐ´request.setCharacterEncoding("UTF-8")£¬½¨ÒéʹÓùýÂËÆ÷¶ÔËùÓÐjsp½øÐбàÂë´¦Àí¡£Õâ¸öÍøÉÏÓÐ


Ïà¹ØÎĵµ£º

Óà JSP ×Ô¼º±àд CKEditor ͼƬÉÏ´«·þÎñÆ÷¶Ë´úÂë

½ñÌìѧ»áÁËÈçºÎ×Ô¼º±àд JSP ÓÃÀ´´¦Àí CKEditor µÄͼƬÉÏ´«¡£
<%@ page import="org.apache.commons.fileupload.FileItem" %>
<%@ page import="java.util.List" %>
<%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory" %>
<%@ page import ......

jsp htmlÇø±ð

jsp(java server pages)ÊÇÒ»ÖÖ¼¼Êõ,ÓÃÀ´´¦Àí¿Í»§¶ËÇëÇóµÄ,(Ä¿µÄÊÇΪÁË´ïµ½¶¯Ì¬ÍøÒ³µÄЧ¹û),´¦Àíºó´«¸ø¿Í»§¶Ë(Ò²¿ÉÒÔ˵¸øÁËä¯ÀÀÆ÷),¾Í³ÉÁËÎÒÃÇ¿´µ½µÄ¾²Ì¬ÍøÒ³(HTML)
 
HTML ¼ÓÈëJava´úÂë(±ÈÈç<%...%>)²»»áÓÖÈκÎЧ¹û,Ö»»á½²<%...%>ÏÔʾµ½Ò³ÃæÐÐ,»òÕ߸ù¾ÝλÖÃÓ°Ïì±àÒë. JSP(Java Server Page)Ò³ÃæÆäʵ¾ÍÊÇ ......

Jsp¿ª·¢ÖÐʹÓÃCookieʵÀý£¨ÊµÏÖ¼ÇסÃÜÂ빦ÄÜ£©

Login.java
/******************************************************/
×¢Ò⣺ÓÉÓÚÔÚjspÖд´½¨Cookieʱ£¬±ØÐë±£Ö¤Cookie´´½¨Óï¾äдÔÚjspÒ³ÃæÍ·²¿µÄ<jsp:include page="includes\head.jsp" flush="true" />±êǩ֮ǰ²Å»áÉúЧ£¬·ñÔòÊÖ¶¯Ìí¼ÓµÄCookieʧ°Ü¡£
ËùÒÔÎÒ¾ö¶¨½²´´½¨CookieÓï¾ä·ÅÔÚservl ......

MysqlͨÓòéѯ²Ù×÷Àà(Jsp+servlet+javaBean+Mysql)

ÔÚÌÚ¿ÆÅàѵÁËÓÐ1¸ö°ëÔÂÁË£¬ÖÕÓÚѧÍêJSP+SERVLET+JAVABEAN+MYSQL£¬Ñ§ÁËjavaµÄµÚÒ»Ì×web½â¾ö·½°¸¡£ÀÏʦҪÇóÎÒÃÇ6ÈËÒ»×鿪ʼ×öÒ»¸ö¶©²Íϵͳ¡£Õâ¸öϵͳûÓÐʲôÌرðµÄ£¬¾Í¸úµç×ÓÉ̳ÇÊÇÒ»¸öÑùµÄ¡£ÓÉÓÚÒª¶ÔÊý¾Ý¿â×ö´óÁ¿µÄÔöɾ¸Ä²é£¬ÄǸö´úÂëÓֶ࣬ÎÒÏëÄܲ»Äܽ«Êý¾Ý¿â²Ù×÷µÄÕâÒ»²ã´ò°üÆðÀ´(SqlOperDao)£¬ÈÃÎÒ¶ÔÊý¾Ý¿â²Ù×÷£¬Óü¸Ðд ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ