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

jspÂÒÂëÎÊÌâ

jspÂÒÂëÎÊÌ⣬ÇóÖú
ÏÂÁ˸ö¼¸ÄêǰµÄjspÔ´Â룬ÎÒ×°ÉϺóÒ»Ö±ÓÐÖÐÎÄÂÒÂëÎÊÌ⣬Êý¾Ý¿âÎÒÓÃmysql£¬
 
²¢ÓÃsql-front²Ù×÷£¬ÔÚÓÃsql-frontµÄʱºòÒѰÑ×Ö·ûÉèÖÃΪgb2312£¬
 
¶øÇÒÔÚsql-frontÖÐÄÜÕýÈ·ÏÔʾÖÐÎÄ£¬µ«¾ÍÊÇÔÚjspÒ³ÃæÉÏÓÃgetstring·½·¨
 
µÃµ½ÂÒÂ룬ÎÒÒ²Óùýgetbytes£¨iso-8859-1£©µÈ·½·¨ÊÔ¹ý»¹ÊÇûÓÐÓá£
 
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" %>
<%@ page pageEncoding="gb2312" %>
ÕâÁ½ÌõÓï¾äÔÚjspÒ³ÃæÒ²¶¼Ð´ÁË
 
Çó¸ßÈËÏàÖú
ÌáÎÊÕߣº 43385607 - Èý¼¶
×î¼Ñ´ð°¸
°ÑISO-8859-1Âëת»»³ÉGB2312
*/
public static String ISOtoGB(String iso){
String gb;
try{
if(iso.equals("") || iso == null){
return "";
}
else{
iso = iso.trim();
gb = new String(iso.getBytes("ISO-8859-1"),"GB2312");
return gb;
}
}
catch(Exception e){
System.err.print("±àÂëת»»´íÎó£º"+e.getMessage());
return "";
 0
»Ø´ðÕߣºÄäÃû 2008-9-11 02:19
ÎÒÀ´ÆÀÂÛ>>
 
Ò»¡¢Êä³öÖÐÎÄ
 
1 JSPÒ³ÃæÍ·²¿¼ÓÉÏÓï¾ä£º<%@page contentType="text/html;charset=utf-8"%>
 
2 SevletÖУºresponse.setContentType("text/html;charset=utf-8");
 
¶þ¡¢»ñÈ¡±íµ¥Êý¾Ý
 
¿ÉÒÔÔÚÿ´Î»ñÈ¡µÄʱºòʹÓãº
 
str=request.getParameter("chStr");
 
str=new String(str.getBytes("ISO-8859-1"),"utf-8");
 
µ«ÊÇÕâÖÖ·½Ê½ºÜ·±Ëö£¬Èç¹ûÐèÒª»ñÈ¡µÄÖÐÎıȽ϶࣬¾Í²»Ì«¿ÉÐС£¿ÉÒÔ¿¼ÂÇʹÓÃFilter¡£
 
ÔÚ%TOMCAT%/webapps/servlets-examples/Web-INF/classes/filtersĿ¼Ï£¬ÓÐÒ»¸öÍêÕûµÄÀý×Ó£¬¿ÉÒÔ½«SetCharacterEncodingFilter.class¿½±´µ½×Ô¼ºÓ¦ÓÃÖУ¬²¢ÉèÖÃweb.xml
 
<filter>
 
   <filter-name>Set Character Encoding</filter-name>
 
   <Filter-class>SetCharacterEncodingFilter</filter-class>
 
   <init-param>
 
        <param-name>encoding</param-name>
 
        <param-value>UTF-8</param-value>
 
</init-param&g


Ïà¹ØÎĵµ£º

×鯴jsp·½·¨3

<table width=100% border="0" align="center" cellpadding="0"
 cellspacing="0">
 <tr>
  <td height="1" class="gray1"></td>
 </tr>
</table>
<tiles:insert attribute="footer" />
</body>
</html:html> ......

jsp visit spring


<%@page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="ccp.suddenattack.service.news.*"%> ......

APACHE+TOMCAT»·¾³ÏÂJSPµÄ±àÂëÎÊÌâ

½ñÌìÓÖÓöµ½ÂÒÂëÎÊÌâ,¿ÉÕæ·³.ΪʲôTOMCAT¾Í²»ÄÜ×Ô¶¯ÅжÏÏîÄ¿µÄ±àÂë,¶øÒ»¶¨ÒªÏîÄ¿×ñÑ­TOMCATµÄ±àÂë.
˵˵½â¾ö·½·¨°É:
ÔÚTOMCATµÄSERVER.XMLÅäÖÃÎļþÖеÄconnectorÖÐÌí¼ÓURIEncoding="UTF-8"ÊôÐÔ,Èç
<Connector port="88" maxHttpHeaderSize="8192" maxThreads="20" minSpareThreads="5" maxSpareThreads="10"
 e ......

ÔÚJSPÒ³ÃæÖÐÓÃselectÏÂÀ­ÁбíÀ´ÏÔʾListÁбíµÄ·½Ê½

Ò» ¡¢ ÓÃstruts2±êÇ©µÄ<s:selectÀ´ÏÔʾ
<s:select cssStyle="width: 84%" list="#application.officeList" headerKey="" headerValue="--ÇëÑ¡Ôñ--" listKey="#this.value" listValue="#this.key+'.'+#this.value" name="entity.officeName" value="entity.officeName"/>
ÆäÖÐ
1¡¢listÊǽÓÊÕjavaÀà»òÕßÔÚÆô¶¯Ê± ......

JSPÌø×ªµÄ¼¸ÖÖ·½Ê½|Struts¶¯Ì¬Ìø×ª

String url="http://www.baidu.com";
   ActionForward gotourl = new ActionForward(url);
   gotourl.setPath(url);
   gotourl.setRedirect(true);
   return gotourl;
  1.RequestDispatcher.forward()
¡¡¡¡ ÊÇÔÚ·þÎñÆ÷¶ËÆð×÷ÓÃ,µ±Ê¹ÓÃforward()ʱ,Servlet engine´ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ