jspµ¼³öword ¼°mht תÂëÎÊÌâ
×î½ü×öÁËÒ»¸ö×ʷѲéѯģ¿é£¬ÀïÃæÉæ¼°½«×Ê·ÑÐÅÏ¢µ¼³öWordÎĵµºÍExcelÎĵµ£¬
ÏÈ˵˵µ¼³öWordÎĵµ£º
Æäʵ¾ÍÊÇ°ÑÏìÓ¦µÄÀàÐÍÉèΪapplication/msword,È»ºó°ÑÄÚÈÝÊä³öµ½Õâ¸öÎļþ¾ÍÐÐÁË
µÚÒ»²½£º
ÏÈÔÚ×ÀÃæÉÏн¨Ò»¸öwordÎĵµ,Ë«»÷´ò¿ª£¬È»ºóÁí´æΪ.htmÎļþ£¬»á²úÉúÒ»¸öÒÔ.htm½áβµÄÎļþ
µÚ¶þ²½£º
°Ñ.htmÎļþÀ©Õ¹Ãû¸ÄΪ.jspÎļþ,´ËʱËü¾ÍÊÇÒ»¸öÓÐwordÅÅ°æ¸ñʽµÄjspÎļþÁË£¬
È»ºóÔÚÕâ¸öÎļþÇ°¼ÓÉÏ£º<%@ page contentType="application/msword;charset=gbk"%>
ÔÙÒýÈëÆäËûÏà¹ØµÄÀà
µÚÈý²½£º°ÑjspÎļþÖУ¬ÐèÒª¶¯Ì¬ÏÔʾµÄ¶«Î÷¸Ä³ÉΪjava´úÂë¾ÍÐÐÁË£¬Í¨³£¾Í»á¶ÔÒ»¸ö¼¯ºÏ»òÖ±½Ó¾ÍÊǽá¹û¼¯½øÐбéÀú
È磺·ÃÎÊ
http://localhost:8080/jxtelecom/exportWord.jsp
³öÏÖ£º
²»Ö§³Ö£¬µ¼³öÖ»¶ÁÎļþ£¬Èç¹û˽â¾öÁË£¬Çë¸øÎÒÁôÑÔ£¬Ð»Ð»¡£
²¹³ä£º½â¾öÂÒÂëÎÊÌâ¡£
ÔÚmhtÎļþÖУ¬¿ÉÒÔ¿´µ½ºº×ֵıàÂë±äÁË£¬Èç“Öйú”±äΪ“中国”ÕâÖÖÆäʵ ÊÇunicodeÂëµÄ10½øÖƱíʾ£¬ÎÒÃÇÔÚjavaÖÐÒ»°ã¿´µ½µÄunicodeÂ붼ÊÇ16½øÖƵġ£Ö÷Ҫд¸ö10½øÖÆunicodeºÍ16½øÖÆunicodeת»»³ÌÐò£¬ÒÔºó¿ÉÒԲο¼Ò»Ï£¬Õâ¸ö¶ÔÓÚÕâ´ÎÏîÄ¿ÖвéѯÊý¾Ý²¢¸ù¾ÝÄ£°åµ¼³öµ½wordÖУ¬½â¾öÁ˼¸ÖÜÀ´µÄÂÒÂëÎÊÌâ¡£ public class TestUnicode {
/**
* ¶þÆÚµ¼³öwordÎĵµ×¨ÓÃתÂë·½·¨
* ·½·¨ËµÃ÷£º°ÑÖÐÎÄ ×ªÎª mhtרÓÃµÄ uncode 10½øÖƱàÂë
* @author peijianwen
* @since 2009-12-01
* @return String
*/
public static String convertUncode10(String s) {
String conStr = "";
// תÂëuncode 10½øÖÆ
for(int i = 0;i<s.length();i++){
char a = s.charAt(i);
conStr += "&#"+ (int)a+";"; //½«ÖÐÎÄת³É10½øÖƵıíʾ
}
return conStr;
}
public static void main(String[] args) {
//½«ÖÐÎÄת³É16½øÖƵıíʾ
System.out.println("\u" + Integer.toHexString('ÖÐ')); //“\u4e2d”
System.out.println("\u" + Integer.toHexString('ÖÐ' & 0xffff)); &nb
Ïà¹ØÎĵµ£º
ÔÚTomcatµÄserver.xmlµÄConnector²¿·ÖÌí¼ÓURIEncoding="GBK"£¬ÈçÏ£ºserver.xmlÌí¼ÓºóÄÚÈÝÈçÏ£º
Xml´úÂë
<Connector URIEncoding="GBK" port="8080"
maxThreads="150" m ......
java£¨jsp)ʹÓÃMySqlÊý¾Ý¿â,ÖÐÎÄÂÒÂëµÄÍêÕû½â¾ö·½°¸
mysqlÊÇÒ»¸öСÐ͵ĿªÔ´µÄÊý¾Ý¿â£¬ÓÃÀ´×ÔѧһЩ¼¼ÊõÊÇÊ®·Ö·½±ãµÄ¡£µ«Ê¹ÓÃmysql´æ´¢Êý¾Ý£¬Ò²»áÓöµ½Ò»Ð©·Ç³£¶ñÐĵÄÎÊÌ⣬È磺ÖÐÎÄÂÒÂëÎÊÌâ¡¢javaÇý¶¯³ÌÐòÎÞ·¨Ê¹ÓõÄÎÊÌ⣨ÒѾ½â¾ö£¬Ïê¼û£ºhttp://hi.baidu.com/lauo1988/blog/item/ff0da655bd3e2eceb745ae0b.html)¡£
......
1. servletÊÇÔÚjavaÀïǶÌ×html,jspÊÇÔÚhtmlÀïÃæǶÌ×java,jspÐèÒªÏȱàÒë³Éservlet²ÅÄÜÖ´ÐÐ.
2. jsp×îÖÕ·Òë³ÉservletÖ´ÐÐ.jspÈÝÒ×ÉÏÊֺͱàд¶øservletÐèÒª×Ô¼ºÊÖ¶¯±àÒë,ºÜÂé·³µÄ
3. servletÏÖÔÚ¸ü¶àÊdz䵱MVCÄ£ÐÍ¿ØÖÆÆ÷µÄ½ÇÉ«,ÓÉËü¸ù¾Ý¿Í»§µÄÇëÇó,À´¶¯Ì¬×éÖ¯·µ»ØÊý¾Ý»òÒ³ÃæµÄÖض¨Ïò,¶øJSPÖ»×öÏÔʾ(MVCÄ£ÐÍ,ÏÔʾ¿ØÖÆÄ£ÐÍ ÏÔ ......
ÍøÕ¾×öÍêºó£¬²¢²»ÊÇÖ±½Ó·Åµ½·þÎñÆ÷£¨Tomcat£©ÖÐÈ¥ÔËÐУ¬¶øÊÇÏȽ«Æä´ò°ü³ÉWarÎļþ£¬ÔÙ°ÑWarÎļþ·Åµ½·þÎñÆ÷ÖÐÈ¥ÔËÐУ¬ÄÇÑù¸ü·½±ã
ÄÇôÔõÑù½«Ò»¸öJspÍøÕ¾´ò°üÄØ£¿£¿£¿
Ò».·½·¨Ò»
½øÈëcmdµ½dosÃüÁîÐÐÏ£¬½øÈëJspWeb(×¢ÒâÒª½øÈëJspWebĿ¼£¬¼´½øÈëÄãÒª´ò°üµÄÍøÕ¾µÄ¸ùĿ¼)
ÔÙÏÂÒ»²½
......
ÔÚtomcatÏÂÕÒµ½tomcat -> conf -> server.xml ÔÚÕâÒ»¾äÖÐÌí¼ÓºìÉ«²¿·Ö
<Connector connectionTimeout="20000" port="9090" protocol="HTTP/1.1" redirectPort="8443" useBodyEncodingForURI="true"
/> <!--URLEncoding=""--> ± ......