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

javaÏîÄ¿ java webÏîÄ¿Êý¾Ý¿âÂÒÂëÎÊÌâµÄ½â¾ö°ì·¨

×÷Ϊjava²ËÄñ£¬ÔÚѧϰµ½Êý¾Ý¿â²Ù×÷µÄʱºòÍùÍù»áÓöµ½Ò»¸öºÜÍ·Í´µÄÎÊÌ⣬Êý¾Ý¿âÖÐÎÄÂÒÂë¡£ÕâËƺõÊÇÿ¸öjava³ÌÐòÔ±Ôڳɳ¤¹ý³ÌÖж¼»áÓöµ½µÄÎÊÌ⣬ÏÂÃæÎҾͰÑÎÒ×Ô¼ºµÄ¼¸ÖÖ·½·¨ºÍ´ó¼Ò·ÖÏíһϡ££¨Ò»°ãÊÇÔÚMyEclipseÏ¿ª·¢£©
javaÏîÄ¿£º
Ê×ÏÈ£¬È·±£ÏîÄ¿µÄ±àÂëÊÇgbk»òutf-8(),ÔÚWindows->Preferences->General->WorkplaceÀï¿ÉÒÔÉèÖá£
Èç¹ûÏîÄ¿ÊÇͨ¹ýxmlÎļþÅäÖÃÊý¾Ý¿â£¨±ÈÈçhibernateÖ®ÀàµÄ¿ò¼Ü£¬·½±ãÊý¾Ý¿âµÄÇл»£©£¬ÔÚÊý¾Ý¿âÁ¬½ÓÓï¾äÈ磺jdbc:mysql://localhost/test1ºó¼ÓÉÏ?characterEncoding=gb2312±ä³É
jdbc:mysql://localhost/test1?characterEncoding=gb2312¡£
×îºó°ÑÊý¾Ý¿âÖеÄ×Ö·û¼¯ÐÞ¸ÄΪgbk2312£¬×Ö·ûЧÑégbk_general_ci»òutf-8,utf_general_ci.
ºÃÁ˲âÊÔһϰɣ¬Èç¹ûÓпÉÊÓ»¯²Ù×÷½çÃæÈçnavicat¾ÍÄÜ¿´µ½ÖÐÎÄÊý¾ÝÁË£¬Èç¹ûÊÇdosϲ鿴µÄ»°£¬ÖÐÎÄ»¹ÊÇ“£¿£¿”£¬²»Òª×ż±ÔÙ²éÊý¾Ý֮ǰÔËÐÐ set names gbk£»ÔÙ²é¾ÍOKÁË¡£
java webÏîÄ¿£º
Íê³ÉÈçÉÏjavaÏîÄ¿µÄÉèÖá£
È·±£jspÒ³µÄ±àÂëΪutf-8¡£
¼ÓÈëÈ«Õ¾ÖÐÎĹýÂËÆ÷£¬¹ýÂËÆ÷servlet´úÂëÈçÏÂ
---------EncodingFilter .java-------
package info.filter;
import java.io.IOException;
import java.util.StringTokenizer;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
public class EncodingFilter implements Filter {
 protected String encoding = null;
 protected FilterConfig config;
 public void init(FilterConfig filterConfig) throws ServletException {
  this.config = filterConfig;
    this.encoding = filterConfig.getInitParameter("Encoding");
 }
 
 public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,ServletException {
  if (request.getCharacterEncoding() == null) {
   
   String encode = getEncoding();
   if (encode != null)
   
    request.setCharact


Ïà¹ØÎĵµ£º

JAVA ÀíÂÛ×ܽá

Ò».±àд¹¹ÔìÆ÷µÄÓÐЧ׼Ôò£º       Óþ¡¿ÉÄܼòµ¥µÄ·½·¨Ê¹¶ÔÏó½øÈëÕý³£×´Ì¬£¬Èç¹û¿ÉÒԵĻ°£¬±ÜÃâµ÷ÓÃÆäËû·½·¨¡£ÔÚ¹¹ÔìÆ÷ÄÚΨһÄܹ»°²È«µ÷ÓõÄÄÇЩ·½·¨ÊÇ»ùÀàÖеÄfinal·½·¨£¨Ò²ÊÊÓÃÓÚprivate·½·¨£¬ËüÃÇ×Ô¶¯ÊôÓÚfinal·½·¨£©¡£ ¶þ.Óü̳нøÐÐÉè¼ÆµÄ×¼Ôò£º     Óü̳бí´ïÐÐΪ¼äµÄ²îÒ ......

Assert ÔÚJavaºÍGroovyÖеÄÇø±ð

¶ÔÓÚ·ÀÓùÐÔ±à³Ì¶øÑÔ£¬assertÒ»Ö±¶¼ÊǷdz£ÖØÒªµÄ¹¤¾ß¡£µ«¶ÔÓÚÊìϤ-ea²ÎÊýµÄJava³ÌÐòÔ±¶øÑÔ£¬µ±ËûÃÇ¿´µ½ËùÓÐGroovy¶ÏÑÔÎÞÂÛÊÇ·ñÓÐ-ea¶¼ÕÕÑùÖ´ÐÐʱһ¶¨»á·Ç³£À§»ó¡£
ÊÂʵÉÏ£¬GroovyµÄ¶ÏÑÔÊÇÎÞÌõ¼þ¿ªÆôµÄ£¡
¶Ô´Ë£¬¿ª·¢ÈËÔ±Roshan Dawrani×öÁËÈçϽâÊÍ£º£¨Ô­ÎÄ£©
The JDK documentation has a long chapter on assertions tha ......

[Java] JRebel + Maven + Jetty ÈȲ¿Êð

Ôç¾ÍÑá·³ÁË Java ¿ª·¢²»¶ÏµÄÈÝÆ÷×Ô¶¯ÖØмÓÔØÂþ³¤µÄ¹ý³Ì£¬Ñо¿ maven + jetty ÈȲ¿Êð·½°¸µÄ¹ý³ÌÖÐżȻ·¢ÏÖÒ»Ñù²»´íµÄ¶«¶«£¬ÊÔÓÃÁËһϹûÈ»ºÜˬ£¬·¢ÉÏÀ´¸ø´ó¼Ò¹²Ïí£¬´ËÎïÃûΪ JRebel (javarebel)£¬Ä¿Ç°Ö§³Ö´ó²¿·ÖÖ÷Á÷µÄ Java ÈÝÆ÷£¬ÅäÖÃÒ²Ï൱¼òµ¥£¬ÒÔÏÂÊÇÓë maven + jetty »·¾³ÕûºÏµÄ²½ÖèÓëÒªµã£º
Ê×ÏÈ£¬ÏÂÔØ JRebel °ü£¬Ä ......

Java¶ÁÈ¡Îļþ´óÈ«

ÉùÃ÷£º´ËÎÄÕÂÊÇÍøÉÏתÐ͹ýÀ´µÄ£¬·Ç±¾ÈËÖø¡£
1¡¢°´×Ö½Ú¶ÁÈ¡ÎļþÄÚÈÝ
2¡¢°´×Ö·û¶ÁÈ¡ÎļþÄÚÈÝ
3¡¢°´ÐжÁÈ¡ÎļþÄÚÈÝ
4¡¢Ëæ»ú¶ÁÈ¡ÎļþÄÚÈÝ
public class ReadfromFile {
    /**
     * ÒÔ×Ö½ÚΪµ¥Î»¶ÁÈ¡Îļþ£¬³£ÓÃÓÚ¶Á¶þ½øÖÆÎļþ£¬ÈçͼƬ¡¢ÉùÒô¡¢Ó°ÏñµÈÎļþ¡£
   &n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ