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

jsp url´«ÖÐÎÄ×î¼òµ¥ÕýÈ·µÄ·½·¨

ÔÚjspÖУ¬Èç¹ûÔÚurlÖд«µÝÖÐÎÄʱ»á³öÏÖÂÒÂ룬ÔÚÍøÉϹØÓÚÕâÒ»ÎÊÌâµÄ½â¾ö·½·¨Î廨°ËÃÅ£¬µ«¶¼²»ÊǺÜ×àЧ£¡Æäʵ½â¾ö·½·¨·Ç³£¼òµ¥£º µÚÒ»²½£º±àÂ루ÒÔ´«µÝµÄ²ÎÊýΪstrΪÀý£© ÔÚ´«µÝÊý¾ÝÇ°½«str½øÐбàÂëJava.net.URLEncoder.encode(str) µÚ¶þ²½£º½âÂë ÔÚ»ñÈ¡Êý¾Ý¶Ë½«µÃµ½µÄÊý¾Ý½øÐнâÂë new String£¨str.getBytes("ISO8859_1")£©
¼òµ¥Ê¾Àý³ÌÐòÈçÏ£º
<%@ page contentType="text/html;charset=gb2312" %>
<a href="ds.jsp?url=<%=java.net.URLEncoder.encode("±àÂëµÄÊÇÕâÀï","GB2312")%>">µã»÷ÕâÀï</a>
<%
//request.setCharacterEncoding("GBK");
if(request.getParameter("url")!=null)
{
str=request.getParameter("url");
//ÏÂÃæÊǽâÂë
str=java.net.URLDecoder.decode(str,"GB2312");
str=new String(str.getBytes("ISO-8859-1"));
out.print(str);
}
%>
À´×Ô£ºhttp://blog.csdn.net/fhm727/archive/2009/09/03/4513811.aspx


Ïà¹ØÎĵµ£º

Ö´ÐÐJSPºóÉú³ÉHTML¾²Ì¬Îļþ

import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.Servl ......

jspÖÐÎÄÂÒÂë½â¾ö·½°¸


1¡¢jspÒ³ÃæÂÒÂ룺
ÔÚjspÒ³Ã濪ʼÌí¼Ó<%pageEncoding="uft-8"%>
2¡¢servletÊä³öÂÒÂ룺
ÔÚÊä³öÄÚÈÝ֮ǰ£¬ÏÈÖ´ÐÐresponse.setContentType
("text/html;charset=utf-8")
3¡¢ÔÚformÀïÓÃpost·½Ê½Ìá½»²ÎÊý£º
1£©½ÓÊÕʱ¼Órequest.setCharacterEncoding("utf-8")
2£©Ê¹ÓùýÂËÆ÷£¬ÔÚ½ÓÊÕ²ÎÊý֮ǰ£¬É趨´«µÝµÄ²ÎÊýÄ ......

oracle+jspÖÐblobÀàÐÍ´æ´¢´óÎı¾ÎÊÌâ½â¾ö·½·¨


 
 
 
 
 
oracle+jspÖÐblobÀàÐÍ´æ´¢´óÎı¾ÎÊÌâ½â¾ö·½·¨
oracle ´æ´¢´óÎı¾Ò»Ö±ÊÇÒ»¸ö¼¬ÊÖµÄÎÊÌâ¡£
Ò»¡¢´æÊý¾Ý¿â£º
<%@page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%
//¶¨Òå±äÁ¿
java.sql.Connection conn; //Êý¾ ......

JSPÒ³ÃæÇ¿ÖƲ»»º´æµÄ·½·¨

ÓеÄÒ³ÃæÐèҪÿ´Îµã»÷½øÈ¥¶¼¶¯Ì¬¸üУ¬¶ø²»ÊǶÁÈ¡»º´æÖеÄÒ³Ãæ¡£
ÔÚJSPÖпÉÒÔÕâÑùʵÏÖ£º
<%
request.setCharacterEncoding("GBK");
response.addDateHeader("Expires",0);
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache");

%> ......

JavaScript ºÍJSP Á¬½ÓSqlServer Êý¾Ý¿â

µÚÒ»ÖÖ JavaScriptÁ¬½ÓÊý¾Ý¿â£º
<mce:script language="JavaScript"><!--
// ´´½¨Êý¾Ý¿â¶ÔÏó
var objdbConn = new ActiveXObject("ADODB.Connection");
// DSN×Ö·û´®
var strdsn = "Driver={SQL Server};SERVER=192.168.0.210;UID=xhb;PWD=xhb;DATABASE=books";
// ´ò¿ªÊý¾ÝÔ´
objdbConn.Open(strdsn);
// ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ