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

java web¹ýÂËÆ÷

filterÔªËغÍfilter-mappingÔªËØ
<filter>¹ýÂËÆ÷ÔªËؽ«Ò»¸öÃû×ÖºÍʵÏÖjavax.servlet.FilterµÄ½Ó¿ÚµÄÀàÏà¹ØÁª¡£
 1 н¨Ò»¸öÀà Encoding Filter   
package cn.bupt.duming.util;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class EncodingFilter implements Filter{
private FilterConfig config = null ;

private String targetEncoding = "ASCLL" ;




public void destroy() {
// TODO Auto-generated method stub
config = null ;
this.targetEncoding = null ;


}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
// TODO Auto-generated method stub

System.out.println("targetEncoding " + this.targetEncoding +"\n");

//Ö´ÐдúÂë

request.setCharacterEncoding(this.targetEncoding) ;

chain.doFilter(request, response) ;

}
public void init(FilterConfig config) throws ServletException {
// TODO Auto-generated method stub

this.config = config ;

//´ÓÅäÖÃÎļþÖжÁÈ¡³õʼ»¯²ÎÊý£¨Ä¿±ê±àÂ룩

this.targetEncoding = config.getInitParameter("encoding") ;

}

}
2 ÅäÖÃFilterÀà¡£ÔÚweb.xmlÖÐÅäÖøÃfilter 
<filter>
<filter-name>EncodingFilter</filter-name>
<filter-class>cn.bupt.duming.util.EncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>GB2312</param-value>
</init-param>

</filter>

<filter-mapping>
<filter-name>EncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
3 ÖØÐÂÔËÐиÃÓ¦ÓÃ
»áÔÚ¿ØÖÆ̨´òÓ¡  targetEncoding GB2312 £¬ ˵Ã÷ÅäÖóɹ¦¡£


Ïà¹ØÎĵµ£º

java web±ê¼Ç¼¼Êõ

1 jsp »ù´¡¸ÅÄî
    jspÊÇÔÚ´«Í³µÄhtmlÒ³ÃæÖУ¬¼ÓÈëjavaµÄ³ÌÐòƬ¶ÎºÍjsp±ê¼Ç£¬¾Í¹¹³ÉÁËjspÒ³Ãæ¡£µ±web·þÎñÆ÷Óöµ½¶ÔjspµÄ·ÃÎÊÇëÇóʱ£¬ÏÈÖ´ÐжÔÆäÖеÄjava³ÌÐòƬ¶Î£¬È»ºóÒÔhtmlµÄ¸ñʽ·µ»Ø¸øÓû§¡£   java³ÌÐòƬ¶Î¿ÉÒÔÓÃÀ´²Ù×÷Êý¾Ý¿â£¬Öض¨ÏòÍøÒ³£¬»òÕßÊÇ·¢ËÍE-mail ,ÑéÖ¤µÇ½ÐÅÏ¢£¬ ÕâЩ²Ù×÷¶¼ÊÇÔÚ·þÎñÆ ......

JAVA ÖÐURLÁ´½ÓÖÐÎIJÎÊýÂÒÂëµÄ´¦Àí·½·¨

JAVA ÖÐURLÁ´½ÓÖÐÎIJÎÊýÂÒÂëµÄÈô¸É´¦Àí·½·¨£¬ÏÖÔÚÕûÀíÊÕ¼ÈçÏÂ:
·½·¨Ò»£º
http://xxx.do?ptname='ÎÒÊÇÖйúÈË'
String strPtname = request.getParameter("ptname");
strPtname = new String(strPtname.getBytes("ISO-8859-1"), "UTF-8");  
·½·¨¶þ£º
<%@ page contentTy ......

16Ììѧ»áJava £¨ºÜ²»´íµÄÎÄÕ£¬ÍƼö£©

Day 01
Ò»¡¢    ´ÓÃæÏò¹ý³Ì±à³Ìµ½ÃæÏò¶ÔÏó±à³ÌµÄ˼άת±ä
ÎÒÃÇÖªµÀËùÓеļÆËã»ú³ÌÐò¶¼ÊÇÓÉÁ½ÀàÔªËØ×é³É£º´úÂëºÍÊý¾Ý¡£´ËÍâ´Ó¸ÅÄîÉϽ«½²£¬³ÌÐò»¹¿ÉÒÔÒÔËûµÄ´úÂë»òÊÇÊý¾ÝΪºËÐĽøÐÐ×éÖ¯±àд¡£Ò²¾ÍÊÇ˵һЩ³ÌÐòΧÈÆ“ÕýÔÚ·¢Éúʲô±àд“£¬¶øÁíһЩ³ÌÐòÔòΧÈƔ˭½«±»Ó°Ï쓱àд¡£ÕâÁ½ÖÖ· ......

Suse LinuxϵͳÏÂJAVA AWT½çÃæÂÒÂëÎÊÌâ

ÔÚSuse10.1Ï°²×°EOS5.3£¬½çÃæ°´Å¥·²ÖÐÎĶ¼ÊÇ·½¸ñ£¬¿ÉÔÚÖն˲鿴ÖÐÎĶ¼ÊǺõģ¬ÍøÉÏËÑÁ˺ü¸Ì죬ÖÕÓÚŪÃ÷°×Ô­Òò¡£
 
EOS5.3ʹÓõÄÊÇjdk1.4.2£¬ÔÚsuseÏÂûÓÐjdkĬÈÏÒªÇóµÄÖÐÎÄ×ÖÌ壬ÐèÒª×ö¶îÍâµÄÅäÖã¬Ð޸ķ½·¨ÈçÏ£º
 
1.ʹÓÃsuÃüÁîÇл»ÎªrootÓû§£¬ÔÙʹÓÃcdÃüÁîÇл»µ½jdk°²×°Â·¾¶ÏµÄjre£»ÀýÈ磺
  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ