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

ÔÚTomcat6.0ÖйØÓÚJSP/Servlet±íµ¥ÂÒÂëµÄÒ»¸ö½â¾ö·½·¨

²½ÖèÒ»£º±à¼­TomcatµÄÅäÖÃÎļþconf/server.xmlÔÚÓÃÓÚ½ÓÊÜ¿Í»§¶ËÓï·¨µÄConnector<connector></connector>±êÇ©ÖÐÌí¼ÓURIEncoding="UTF-8"ÊôÐÔ£¬¸ÃÊôÐÔÓÃÀ´½â¾öGETÖеıàÂëÎÊÌâ¡£
xml ´úÂë
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />
²½Öè¶þ£ºÔÚÿ¸öÐèÒªÌá½»±íµ¥²ÎÊýµÄJSP/Servlet֮ǰ¼ÓÈëÏÂÁдúÂëÀ´ÉèÖÃ×Ö·û¼¯£¬ÓÃÓڸ㶨POSTÇëÇó£º
java ´úÂë
request.setCharacterEncoding("UTF-8");
ÕâÑù»ù±¾¾Í¸ã¶¨ÁË×Ö·ûÂÒÂëÎÊÌâÁË£¬ÊµÏÖÉÏÊöÎÊÌâµÄÒªÇóÊÇËùÓеÄÍøÒ³±àÂë±ØÐëÊÇUTF-8±àÂë¼È¡£
ÔÚ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">
ÒÔÉϲâÊÔÔÚTomcat 6.0.14¡¢IE6.0¡¢FireFox2.0.13¼°Opera9.25ÖвâÊÔͨ¹ý£¬¿ª·¢»·¾³Ê¹ÓÃnetBeans 6.0
¸½²âÊÔ´úÂ룺
html´úÂë
Document : zc
Created on : 2007-12-22, 17:20:24
Author : °¡´º
-->
>
<html>
<head>
<title>title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
head>
<body>
<form action="/wat1/t1" method="GET">
ÐÕÃû£º<input type="text" name="name" value="" size="20" />
ÃÜÂ룺<input type="password" name="passwd" value="" size="20" />
<input type="submit" value="×¢²á" />
form>
<br />
<form action="/wat1/t1" method="POST">
ÐÕÃû£º<input type="text" name="name" value="" size="20" />
ÃÜÂ룺<input type="password" name="passwd" value="" size="20" />
<input type="submit" value="×¢²á" />
form>
body>
html>
java ´úÂë
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
/* TODO output your page here
out.println("");
out.println("");


Ïà¹ØÎĵµ£º

JSP·ÖÒ³¼¼ÊõʵÏÖ

title: JSP·ÖÒ³¼¼ÊõʵÏÖ
summary:ʹÓù¤¾ßÀàʵÏÖͨÓ÷ÖÒ³´¦Àí
author: evan_zhao
email: evan_zhao@hotmail.com
¡¡¡¡Ä¿Ç°±È½Ï¹ã·ºÊ¹ÓõķÖÒ³·½Ê½Êǽ«²éѯ½á¹û»º´æÔÚHttpSession»òÓÐ״̬beanÖУ¬·­Ò³µÄʱºò´Ó»º´æÖÐÈ¡³öÒ»Ò³Êý¾ÝÏÔʾ¡£ÕâÖÖ·½·¨ÓÐÁ½¸öÖ÷ÒªµÄȱµã£ºÒ»ÊÇÓû§¿ÉÄÜ¿´µ½µÄÊǹýÆÚÊý¾Ý£»¶þÊÇÈç¹ûÊ ......

jspÇå³ýÒ³Ãæsession¡¢cookies»º´æ

Ò»¡¢Çå³ýÒ³Ã滺´æ
ÔÚjspÒ³Àï
<%response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
response.flushBuffer();%>
ÔÚhtmlÒ³Àï
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META HTTP-EQUI ......

jsp ÑéÖ¤

³¤¶ÈÏÞÖÆJavaScript´úÂë
CODE:
<script> function test() { if(document.a.b.value.length>50) { alert("²»Äܳ¬¹ý50¸ö×Ö·û£¡"); document.a.b.focus(); return
false; } } </script> <form. name=a nsubmit="return test()"> <textarea name="b" cols="40" wrap="VIRTUAL" rows="6"></te ......

Êý¾Ý¿â»º´æ·½°¸£¨Java°æµÄ£¬º¬²âÊÔJSP£©£¨×ª£©

http://hi.baidu.com/shedewang/blog/item/b4a71b254e43ce35c895599b.html
˵ÊÇÖ§³Ö1ÒÚpv/Ì죬ҲÐíÓеã¿äÕÅ£¬µ«Èç¹ûÄúÄÜÈÏÕæ¿´ÍêÏàÐÅÒ²²»»áÈÃÄúʧÍû¡£
Èç¹û´ó¼ÒÕæÏëÖ§³ÖÎÒ¡¢Ö§³ÖÖйúÈË¿ªÔ´ÏîÄ¿£¬Çë°Ñ¸ÃÎÄÌùµ½×Ô¼ºµÄ²©¿ÍÖлòÕßÊղر¾ÎÄ£¬¼ÇµÃ°üº¬ÎĵµµÄÏÂÔصØÖ·£¡£¡£¡£¡£¡£¡£¡Ð»Ð»¡£
ÎÒ˵µÄϵͳÖ÷ÒªÊǹ¹½¨ÔÚhibernateÖ®ÉÏ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ