jsp ÖÐÂÒÂëµÄ - Java / Web ¿ª·¢
ÎҵĿª·¢µÄƽ̨ÊÇMyeclipes6.0 + tomcat5.x + mysql
ÎÒËùÓеıàÂ뷽ʽ¶¼ÊÇÓõÄUTF-8
ÎÒÖ»ÓÃÁËStrtus¿ò¼Ü
ÔÚÒ»¸öformÖÐÈçÏÂÓõÄÊÇpostµÄÌá½»·½Ê½£º
<form class="form" action="submitreply.do?id=<%=a.getId() %>&rootId=<%=a.getRootId() %>" method="post">
±êÌ⣺
<input name="title" type="text"/>
<br>
ÄÚÈÝ£º
<textarea name="cont" rows="15" cols="80"></textarea>
<br>
<input class="input_submit" name="submit" type="submit" value="Ìá½»"/>
</form>
È»ºóÎÒÓÃÒ»¸öActionFormÀ´ÊÕ¼¯Êý¾Ý£¬µ«ÊÇÊÕ¼¯µÄÊý¾ÝÊÇÂÒÂ룬¼´Ê¹ÔÚÇëÇóµÄÒ³ÃæÎÒ¼ÓÉÏÁË<%request.setCharacterEncoding("GBK");%>»òÕß<%request.setCharacterEncoding("UTF-8");%> µ«ÊÇÊÕ¼¯µ½µÄÊý¾ÝÒÀÈ»ÊÇÂÒÂ룬×îºó²»µÃ²»ÓÃString cont = new String(afn.getCont().getBytes("ISO-8859-1"),"UTF-8");ÕâÖÖ·½Ê½×ª»»±àÂë²Å¿ÉÒÔ£¬ÎÒ¾õµÄÿһ´Î¶¼ÓÃÕâÖÖ·½Ê½Ì«Âé·³ËùÒÔÇëÄÇλ´óϺÀ´¸øÖ¸µãһϣ¬Ð¡µÜ²»Ê¤¸Ð¼¤£¡£¡£¡
ÄãµÄMYSQLÖÐÊDz»ÊÇÒ²ÊÇUTF-8ѽ£¬¿´Ò»ÏÂÄãµÄMYSQLÖеıàÂë¿ÉÄÜÊÇÕâµÄÎÊÌâ
¶¥
¿´¿´mysqlµÄÅäÖÃÎļþ 57Ðиú81ÐÐÊDz»ÊÇutf-8
ÓùýÂËÆ÷¾ÍºÃÁË£¬ÔÚÍøÉÏÕÒ¸ö¹ýÂËÆ÷°É
Ö±½ÓÔÚtomcateÀïÃæÖе
Ïà¹ØÎÊ´ð£º
²»ÖªµÀÊÇʲôÔÒò£¬ÎÒ¸ÃÈçºÎ´¦Àí£¬Çë´óϺÃÇÖ¸½ÌÁË£¬Ð¡µÜÔÚ´Ëл¹ý¡£¡£¡£¡£
´íÎóÐÅÏ¢ÈçÏ£º
The program being debugged was signaled while in a function called from GDB.
GDB has restored the context t ......
<%@ page contentType = "text/html;charset =gb2312"%>
<%!
public String codeToString(String str)
{
String s =str;
&nbs ......
ÎÒÔÚÒ»¸öjspÒ³ÃæÖÐÓкܶà¸öͨ¹ýÑ»·²úÉúµÄÔªËØ£¬ÓÐtext£¬selectµÈ£¬ÔõôÉèÖÃtab¼üÖ»ÔÚtextÔªËØÖ®¼äÌø¶¯£¬¶ø²»È¥¾Û½¹selectÔªËØ£¿£¿£¿¼±£¡¼±£¡¼±£¡Âé·³ÄÄλ¸ßÊÖÖ¸µãһϣ¡
½« <input type="text">µÄ ......
Java code:
if(request.getAttribute("top")==null){
request.setAttribute("top","1");
}
String topS=(String)request.getAttribute("top");
top=Integer.pa ......