ÈçºÎ½â¾ö 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);
}
%>
Ïà¹ØÎĵµ£º
jspÖеÚÒ»¾ä£º
<%@ page language="java" import="java.sql.*,java.util.*," contentType="text/HTML;charset=gb2312" pageEncoding="gb2312"%>
htmlÖмÓÉÏ
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
ͨ³£ÕâÑù¾ÍûÓÐÎÊÌâÁË¡£ .
ÔÙÕߣº µ¼ÈëjsʱºòÉ ......
JSPÖеÄCOOKIE²Ù×÷
Cookie¸ÅÄî:
CookieµÄ¸ñʽʵ¼ÊÉÏÊÇÒ»¶Î´¿Îı¾ÐÅÏ¢, ÓÉ·þÎñÆ÷Ëæ×ÅÍøÒ³Ò»Æð·¢Ë͵½¿Í»§¶Ë, ²¢±£´æÔÚ¿Í»§¶ËÓ²ÅÌÖÐÖ¸¶¨µÄĿ¼µÄ. ´ó¼Ò¶¼´«ËµCookie»áÔì³ÉÑÏÖصݲȫÍþвʲôµÄ, Æäʵ²»ÊÇÕâô»ØÊÂÇé. ·þÎñÆ÷¶ÁÈ¡CookieµÄʱºò, Ö»Äܹ»¶ÁÈ¡µ½Õâ¸ö·þÎñ ......
Servlet£º
ÔÚServletÖУ¬ÌøתÔÚdoGet»òÕßdoPost·½·¨ÖÐʵÏÖ¡£
<1>redirectʵÏÖÒ³ÃæÌøת£º
response.sendRedirect("/login.jsp");
·½·¨µÄ²ÎÊýÊÇÏà¶Ô·¾¶£¬É趨Õâ¸ö²ÎÊý¿ÉÒÔʹҳÃæÌøתµ½ÈκÎÒ³Ã棬°üÀ¨www.baidu.comµÈÍøÂçÒ³Ãæ¡£
ÌøתºóÄã¿ÉÒÔ·¢ÏÖµØÖ·À¸·¢ÉúÁ˱仯¡£
µ×²ãÔÀí£ºÊ¹ÓÃredir ......
ÔÚsql2000Öд´½¨´æ´¢¹ý³Ì£º
--ÇóÁ½ÊýÖ®ºÍ
create proc up_sum @a int ,@b int ,@result int output
as
select @result= @a+@b
µ÷Ó÷½·¨£º
...
CallableStatement cstmt=con.prepareCall("exec up_sum ?,?,?");
cstmt.registerOutParameter(3,java.sql.Types.INTEGER);
&nb ......