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

µ±jspºÍservlet³öÏÖÂÒÂëÎÊÌâºóµÄ½â¾ö·½°¸

ÉÏÍø¿´Á˺ö࣬¾ÍÕâһƪ½â¾öÁËÎÒµÄÎÊÌ⣬ÏÖת£¬ÎÒµÄÏîÄ¿ÓõÄÊÇMVC¼Ü¹¹£¬ÓÐͳһµÄ¿ØÖÆÆ÷£¬×ªÏò²»Í¬µÄAction£¬ÉÏÍø¿´Á˺ö࣬´ó²¿·ÖÊÇ˵¼ÓÈërequest.setCharacterEncoding("utf-8");µ«ÊǾ­¹ýÎÒµÄÊÔÑ飬ÕâÖ»ÓÐÔÚÀûÓÃJSP´¦Àí±íµ¥´«ÊäÊý¾Ýʱ²Å¿ÉÓã¬ÔÚÎҵĶ«Î÷ÖÐÎÞ·¨½â¾ö£¬ºóÀ´·¢ÏÖ»¹ÊÇÓÃFilterChainºÃ£¬ºÇºÇ£¬Öص㻹ÊÇÔÚrequest.setCharacterEncoding("")ÖУ»Ï£Íû¶Ô´ó¼ÒÓеã°ïÖú
ת×Ô£¨http://www.itwis.com/html/java/jsp/20080814/2158.html£©
µ±jspºÍservlet³öÏÖÂÒÂëÎÊÌâºóµÄ½â¾ö·½°¸
À´Ô´£º ·¢²¼Ê±¼ä£º2008-08-14 ·¢²¼ÈË£º ä¯ÀÀ£º162 È˴Π  ×ÖÌ壺 [´ó ÖРС]   
     ÔÚ½øÐÐjspºÍservletµÄ¿ª·¢Ê±£¬ºÜÓпÉÄÜÓöµ½³öÏÖÁËÖÐÎÄÂÒÂëÎÊÌ⣬ÏÖÔÚÎÒÃÇÀ´¿´¿´±ÊÕßÊÇÈçºÎ½â¾öµÄ£¬ËûÒ²ÊÇÓÃÁËÐí¶à·½·¨£¬·¢ÏÖ»¹Êǽâ¾ö²»ÁË¡£×îºóÓÃÁ˹ýÂËÆ÷£¬²ÅËãÖսᡣ
   ´Ë·½·¨×ܽáÈçÏ£ºÔÚjspÒ³ÃæÖÐʹÓÃ<%@ page pageEncoding="GB2312"%> £¬ÕâÀïµÄpageEncodingÊÇGB2312,ÄÇôÎÒÃÇÔÚ¹ýÂËÆ÷web.xmlÖÐËùʹÓõÄ<param-value>GB2312</param-value>ҲΪGB2312¡£×ÜÖ®Ò»Ìõ£º¾ÍÊÇÉÏÊöÁ½ÕßÒ»Ö¼´¿É,±ÈÈçͬΪUTF-8
½«¹ýÂËÆ÷µÄjava´úÂëºÍweb.xmlµÄÅäÖÃд
//--------java´úÂ벿·Ö£ºCharsetFilter .java
package com;
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 CharsetFilter implements Filter {
private String charset = "GB2312";
public void destroy() {
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain arg2) throws IOException, ServletException {
request.setCharacterEncoding(charset);
arg2.doFilter(request, response);
}
public void init(FilterConfig arg0) throws ServletException {
charset = arg0.getInitParameter("charset");
System.out.println("×Ö·û¹ýÂËÆ÷¿ªÆô£¬µ±Ç°×´Ì¬£º"+charset);
}
}
//--------web.xml²¿·Ö£¨ÒÔϲ¿·Ö¿ÉÒÔÖ±½Ó¸´ÖÆÕ³Ìùµ½WEB.XMLÏ£©
<filter>
<filter-name>CharsetFilter</filter-name>
<filter-class>com.CharsetFilter</fi


Ïà¹ØÎĵµ£º

ÎÒ¿ª·¢Ò»¸öjspϵͳʱÅöµ½µÄÎÊÌâ

1.No getter method for property name problem(struts)
ÓÐÒ»ÖÖ¿ÉÄÜÊÇBeanûÓÐдÏàÓ¦µÄget·½·¨£¬ÀýÈç±äÁ¿userNameµÄget·½·¨ÊÇgetUserName£»
»¹ÓоÍÊÇÕâ¸öBeanΪ¿Õ£»
2.
MyEclipseµÄ×Ô¶¯Ìí¼ÓstrutsºÍhibernate¹¦Äܲ»ÄÜ·µ»Ø£¬Çë×¢Ò⣡
ËùÒÔÎÒÏÈʹÓÃMyEclipseµ¼ÈëstrutsºÍhibernate£¬È»ºó½«ËüÃǵÄjarµ¼Èëµ½ÁíÍâÒ»¸öн¨µÄ ......

JSP,servletµÄÏà¶Ô·¾¶ÎÊÌâ

Ç°Ì᣺¼ÙÉèÄãµÄ Http µØַΪ http://192.168.0.1/ ÄãµÄ web Ó¦ÓÃΪ webapp £¬ÄÇôÄãµÄ web Ó¦Óà URL Ϊ http://192.168.0.1/webapp/
[ÎÊÌâ1]
[ÃèÊö]µ±ÔÚ jsp ÖÐÒýÈë css ʱ£¬Èç¹ûÆäÏà¶Ô·¾¶Ïà¶ÔÓÚµ±Ç° jsp ÎļþµÄ£¬¶øÔÚÒ»¸öºÍÕâ¸ö jsp µÄ·¾¶²»Ò»ÑùµÄ servlet ÖÐ forwarder Õâ¸ö jsp ʱ£¬¾Í»á·¢ÏÖÕâ¸ö css Ñùʽ¸ù±¾Ã»ÓÐÆ ......

JSPʵÀýÒ»¡¢¹ºÎï³µ


֪ʶ׼±¸£º
JDBC·ÃÎÊÊý¾Ý¿âµÄ»ù±¾²½Öè
£¨1£©¡¢½«Êý¾Ý¿âµÄJDBCÇý¶¯¼ÓÔص½¹¤³ÌÀà¿âÖС£
£¨2£©¡¢¼ÓÔØJDBCÇý¶¯£¬²¢½«Æä×¢²áµ½DriverManagerÖС£ÏÂÃæÊÇһЩÖ÷Á÷Êý¾Ý¿âµÄJDBCÇý¶¯¼ÓÔØ×¢²áÂ룺
¢Ù¡¢oracleÊý¾Ý¿â
Class.forName(“oracle.jdbc.driver.OracleDriver”).newInstance();
¢Ú¡¢Sql Server 7.0/2000Êý¾ ......

jspµÄ9¸öÄÚ½¨¶ÔÏó

ÔÚjspÖв»Óö¨Òå¿ÉÒÔÖ±½ÓÓõľÍÊÇjspµÄ9¸öÄÚ½¨¶ÔÏóÁË
1£¬Request 2,Response 3,session 4,out 5,page
6,application 7,pageContext 8,config
9,exception
1¡¢Request¶ÔÏó
¸Ã¶ÔÏó·â×°ÁËÓû§Ìá½»µÄÐÅÏ¢£¬Í¨¹ýµ÷ÓøöÔÏóÏàÓ¦µÄ·½·¨¿ÉÒÔ»ñÈ¡·â×°µÄÐÅÏ¢£¬¼´Ê¹ÓøöÔÏó¿ÉÒÔ
»ñÈ¡Óû§Ìá½»µÄÐÅÏ¢¡£
µ±Request¶ÔÏó»ñÈ¡¿Í» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ