jspÂÒÂë³õ¼¶½â¾ö·½°¸
×î»ù±¾µÄÂÒÂëÎÊÌâ
Õâ¸öÂÒÂëÎÊÌâÊÇ×î¼òµ¥µÄÂÒÂëÎÊÌâ¡£Ò»°ãлá³öÏÖ¡£¾ÍÊÇÒ³Ãæ±àÂë²»Ò»Öµ¼ÖµÄÂÒÂë¡£
Html´úÂ룺
£¼%@ 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µÄ±àÂë¸ñʽ¡£ËùÒÔÈç¹ûûÓÐÕâÒ»ÐеĻ°£¬“ÎÒÊǸöºÃÈ˔Ҳ»á³öÏÖÂÒÂë¡£±ØÐëÒ»Ö²ſÉÒÔ¡£
µÚÈý´¦±àÂëΪ¿ØÖÆä¯ÀÀÆ÷µÄ½âÂ뷽ʽ¡£Èç¹ûÇ°ÃæµÄ½âÂ붼һÖ²¢ÇÒÎÞÎóµÄ»°£¬Õâ¸ö±àÂë¸ñʽûÓйØϵ¡£ÓеÄÍøÒ³³öÏÖÂÒÂ룬¾ÍÊÇÒòΪä¯ÀÀÆ÷²»ÄÜÈ·¶¨Ê¹ÓÃÄÄÖÖ±àÂë¸ñʽ¡£ÒòÒ³ÃæÓÐʱºò»áǶÈëÒ³Ã棬µ¼ÖÂä¯ÀÀÆ÷»ìÏýÁ˱àÂë¸ñʽ¡£³öÏÖÁËÂÒÂë¡£
±íµ¥Ê¹ÓÃ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"ÊÇ
Ïà¹ØÎĵµ£º
ÎÊÌâÈçÏ£º
֮ǰ,д¹ýÒ»¸öDownload.jspÎļþ,¿ÉÒÔ½â¾öÏÂÔØÎļþÂÒÂëÎÊÌâ(ÖîÈç:DOC,XSLÎļþµÈµÈ).
ºóÀ´·¢ÏÖ,Óöµ½ÖÐÎÄÃûµÄÎļþµÄʱºò,ÎļþÏÂÔؽ«»á±¨´í~~~~
½ñÌì,ͨ¹ý¸ÄдÔDownload.jspÎļþÒѾ³¹µ×½â¾öÁËÕâ¸öÎÊÌâ~
ÏÖÔÚ,°ÑÒ»ÕûÌ×µÄÎļþÉÏ´«ÏÂÔصķ½·¨¸øÌù³öÀ´~~~ÒÔ±ã´ó¼Ò½è¼ø!~!~!~!~!
×÷Õß:¹Å°£¼°·¨ÀÏ
download ......
¡¡¡¡ RSS2.0ÔÚÍøÂçÉÏ´óÐÐÆäµÀ,¸÷ÖÖÍøÕ¾¶¼¼ÓÉÏRSSÖ§³Ö,¹ØÓÚRSS¹æ·¶,¿ÉÒÔä¯ÀÀһϠhttp://blogs.law.harvard.edu/tech/rss
Ôڼƻ®Éú³ÉRSSÎļþµÄʱºò,˳±ãËÑË÷ÁËÒ»ÏÂJIRAºÍConfluenceµÄ³ÌÐò,·¢ÏÖËüÃÇ·Ö±ðÊÇÓÃÄ£°å·½Ê½ºÍJSP¶¯Ì¬Ò³ÃæÀ´Õ¹Ê¾µÄ.
ÓÚÊÇÎÒÒ²Ïëµ½Á½ÖÖ·½Ê½:
¡¡¡¡1.ÓÃFreeMarkerÉú³É¾²Ì¬Îļþ,ÊÊÓÃÓÚ¸üв ......
Excel±¨±íµÄ·½·¨£¬Ò»¸ö¹ý춼òµ¥£¬Ò»¸öÖ»ÄÜÓÃì¶windowƽ̨(ÒòΪʹÓÃjdbc-odbc bridge)£¬ÇÒÎÞ·¨Ê¹Óõ½ExcelÄÚ²¿µÄ¸÷ÖÖ¹«Ê½»òÊÇ·½·¨£¬Òò´Ë£¬½ñÌì½éÉÜÒ»¸öapache³öµÄÔª¼þ½ÐPOI£¬Ëü¿ÉÒÔÔÚUNIX»òwindowƽ̨´¦Àíword»òExcelµµ°¸£¬¶ø²»ÐèÒªÒÀ¿¿windowµÄcom£¬²¢ÇÒ¿ÉÉ趨´¢´æ¸ñ¸ñʽ¡¢ÁÐÓ¡¸ñʽµÈµÈ£»½ñÌìÎÒÀ´½éÉÜÆäÖÐÓйØ×ÊÁ϶ÁÈ¡¡¢ÐÂÔ ......
ʹÓÃJSP´óÔ¼ÓÐÏÂÁÐÈýÖÖÌøת·½Ê½£º
1. response.sendRedirect();
2. response.setHeader("Location","");
3. £¼jsp:forward page="" /£¾
¾¹ýÊÔÑéµÃµ½ÏÂÃæµÄһЩ¹æÔò£º
Ò». response.sendRedirect()
´ËÓï¾äÇ°²»ÔÊÐíÓÐout.flush()£¬Èç¹ûÓÐout.flush()£¬»áÓÐÒì³££º
java.lang.IllegalStateException: Can't send ......
el±í´ïʽ·ÖÀà
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
·Ö Àà ¹¦ÄÜ·ÖÀà ±êÇ©Ãû³Æ
Core ±í´ïʽ²Ù×÷ out
set
remove
catch
Á÷³Ì¿ØÖÆ if
......