½â¾önetbeansдjsp³öÏÖÖÐÎÄÂÒÂëµÄÎÊÌâ
jsp±íµ¥Ìá½»µÄÊý¾ÝÓÐÖÐÎÄʱ³öÏÖÂÒÂ룬²¢·Ç¶ÁÈ¡Êý¾Ý¿âÊý¾ÝºóÏÔʾÂÒÂ룬ÒÔÏÂÊǽâ¾öµÄ·½·¨¡£
netbeans´´½¨jspµÄÄ£°æÖÐÊÇ£º<%@page contentType="text/html" pageEncoding="UTF-8"%>£¬½«ÕâÐиijÉÒÔÏÂÕâÑù¾Í¿ÉÒÔÕý³£ÏÔʾÖÐÎÄ£º
<%@page language="java" pageEncoding=utf-8" %>
<%@page contentType=”text/html;charset=utf-8” %>
ÏÂÃæÊÇÔÚÍøÉÏÕªµÄ¹ØÓÚÒ³Ãæ±àÂë²»Ò»Ö¶ø²úÉúÂÒÂë
´úÂë
<%@ 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ÎļþµÄ´æ´¢¸ñʽ¡£Ecljpse»á¸ù¾ÝÕâ¸ö±àÂë¸ñʽ±£´æÎļþ¡£²¢±àÒëjspÎļþ£¬°üÀ¨ÀïÃæµÄºº×Ö¡£
µÚ¶þ´¦±àÂëΪ½âÂë¸ñʽ¡£ÒòΪ´æΪUTF-8µÄÎļþ±»½âÂëΪiso8859-1£¬ÕâÑùÈçÓÐÖÐÎĿ϶¨³öÂÒÂë¡£Ò²¾ÍÊDZØÐëÒ»Ö¡£¶øµÚ¶þ´¦ËùÔÚµÄÕâÒ»ÐУ¬¿ÉÒÔûÓС£È±Ê¡Ò²ÊÇʹÓÃiso8859-1µÄ±àÂë¸ñʽ¡£ËùÒÔÈç¹ûûÓÐÕâÒ»ÐеĻ°£¬“ÎÒÊǸöºÃÈ˔Ҳ»á³öÏÖÂÒÂë¡£±ØÐëÒ»Ö²ſÉÒÔ¡£
µÚÈý´¦±àÂëΪ¿ØÖÆä¯ÀÀÆ÷µÄ½âÂ뷽ʽ¡£Èç¹ûÇ°ÃæµÄ½âÂ붼һÖ²¢ÇÒÎÞÎóµÄ»°£¬Õâ¸ö±àÂë¸ñʽûÓйØϵ¡£ÓеÄÍøÒ³³öÏÖÂÒÂ룬¾ÍÊÇÒòΪä¯ÀÀÆ÷²»ÄÜÈ·¶¨Ê¹ÓÃÄÄÖÖ±àÂë¸ñʽ¡£ÒòΪҳÃæÓÐʱºò»áǶÈëÒ³Ã棬µ¼ÖÂä¯ÀÀÆ÷»ìÏýÁ˱àÂë¸ñʽ¡£³öÏÖÁËÂÒÂë¡£
ÔÚJSPÖУº
jsp ´úÂë
<%@page contentType="text/html" pageEncoding="UTF-8"%>
ÔÚServletÖУº
java ´úÂë
response.setContentType("text/html;charset=UTF-8");
ÔÚËùÓеÄÍøÒ³ÖУº
html´úÂë
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
NetbeansͳһUTF-8±àÂëµÄ·½·¨
1.ÕÒµ½ÄãµÄNetbeans°²×°Ä¿Â¼ÏµÄetcÎļþ¼Ð,ÈçC:\Program Files\NetBeans 6.0 M9\etc
2.ÓüÇʱ¾´ò¿ªnetbeans.conf
3.ÕÒµ½netbeans_default_optionsÕâÒ»¾ä(û´ø#ºÅµÄ,´ø#ºÅµÄÊÇ×¢ÊÍ)
4.ÔÚ
Ïà¹ØÎĵµ£º
GBK±àÂë
GBK±àÂëÊÇÖйúÖƶ©µÄ¡¢µÈͬÓÚUCSµÄеÄÖÐÎıàÂëÀ©Õ¹¹ú¼Ò±ê×¼¡£GBK¹¤×÷С×éÓÚ1995Äê10Ô£¬Í¬Äê12ÔÂÍê³ÉGBK¹æ·¶¡£¸Ã±àÂë±ê×¼¼æÈÝGB2312£¬¹²ÊÕ¼ºº×Ö21003¸ö¡¢·ûºÅ883¸ö£¬²¢Ìṩ1894¸öÔì×ÖÂë룬¼ò¡¢·±Ìå×ÖÈÚÓÚÒ»¿â¡£
UTF-8±àÂë
UTF-8±àÂë¿ÉÒÔͨ¹ýÆÁ±ÎλºÍÒÆλ²Ù×÷¿ìËÙ¶Áд¡£×Ö·û´®±È½Ïʱstrcmp()ºÍ
wcscmp()µÄ· ......
jsp request session
µÈ¶ÔÏó
Ïê½â
תÕß×¢£º´ËÎÄ×ܽá½ÏΪÏêϸ£¬ÖµµÃ²Î¿¼¡£µ«²¿·ÖÄÚÈݾ¹ýÕûÀí£¬ÒÔÏÂÊÇÕýÎÄ¡£
1.request
¶ÔÏó
ÕâÁ½¸ö¶ÔÏóÊÇASPËùÌṩµÄÄÚÖöÔÏóÖÐ×î³£ÓõÄÁ½¸ö¡£ÔÚä¯ÀÀÆ÷£¨»òÆäËûÓû§´úÀí£©ºÍWeb·þÎñÆ÷Ö®¼ä£¬ÇëÇóÓëÏìÓ¦Öз¢ÉúµÄÐÅÏ¢½»Á÷¿ÉÒÔͨ¹ýASPÖеÄÁ½¸öÄÚÖöÔÏóÀ´½øÐÐ ......
Excel±¨±íµÄ·½·¨£¬Ò»¸ö¹ý춼òµ¥£¬Ò»¸öÖ»ÄÜÓÃì¶windowƽ̨(ÒòΪʹÓÃjdbc-odbc bridge)£¬ÇÒÎÞ·¨Ê¹Óõ½ExcelÄÚ²¿µÄ¸÷ÖÖ¹«Ê½»òÊÇ·½·¨£¬Òò´Ë£¬½ñÌì½éÉÜÒ»¸öapache³öµÄÔª¼þ½ÐPOI£¬Ëü¿ÉÒÔÔÚUNIX»òwindowƽ̨´¦Àíword»òExcelµµ°¸£¬¶ø²»ÐèÒªÒÀ¿¿windowµÄcom£¬²¢ÇÒ¿ÉÉ趨´¢´æ¸ñ¸ñʽ¡¢ÁÐÓ¡¸ñʽµÈµÈ£»½ñÌìÎÒÀ´½éÉÜÆäÖÐÓйØ×ÊÁ϶ÁÈ¡¡¢ÐÂÔ ......
ÎҵĻ·¾³:
--------
1. java±àÒëÆ÷:eclipse 3.0.2
2. web·þÎñÆ÷: tomcat 4.1.24
3. C±àÒëÆ÷: VC6.0
4. ²Ù×÷ϵͳ: win2k
5. javaÔ´ÎļþĿ¼: d:\study\src
6. java±àÒëºóµÄclassÎļþĿ¼: d:\study\bin
7. tomcatĿ¼: d:\tomcat41
1.±àдjavaÎļþ:
//Util.java
package com.jni;
public class Util
{
& ......
½ñÌìÔÚѧϰjspÖÐÊý¾Ý¿âµÄʹÓÃʱ£¬Óöµ½Ò»¸öºÜÆæ¹ÖµÄÇé¿ö£¨ÖÁÉÙÏÖÔÚ¿´À´Êǵģ©¡£jspÖÐÁ¬½ÓmysqlÊý¾Ý¿â£¬¿ªÆômysqlÊý¾Ý¿âºó£¬ÔÚjspÒ³ÃæÖÐǶÈëµÄjavaÁ¬½ÓmysqlÊý¾Ý¿âµÄÄǼ¸¾ä´úÂë¡£ºÃÏñ Class.forName("org.gjt.mm.mysql.Driver");ûÆðµ½×÷Óã¬Ö»ÐèÒªConnection con=DriverManager.getConnection("jdbc:mysql://localhost/test? ......