ÀûÓÃJSP£¬·ÀÖ¹Öظ´Ìá½»µÄÎÊÌâ
Ò»°ã£¬ÔںܶàÓ¦ÓÃϵͳÖУ¬Óû§¶à´ÎÌá½»Öظ´Êý¾ÝÊÇÒ»¸öºÜÑÏÖصÄÎÊÌ⣬»áµ¼ÖÂÓ¦ÓÃϵͳÖкܶàÀ¬»øÊý¾Ý£¬ÔÚStrutsÖпò¼ÜÖУ¬ÓÐTOKEN»úÖÆÀ´·ÀÖ¹Óû§Ìá½»Öظ´Êý¾Ý£¬ÕâÊÇÒ»¸öºÜºÃµÄ°ì·¨£¬µ«ÊÇ£¬TOKEN»úÖƱØÐëµÃÓõ½html:form±êÇ©£¬ÎÒ²»Ï²»¶ÓÃÕâ¸ö±êÇ©£¬ÎÒ¾õµÃÊÇÒ»¸öÀÛ׸£¬ËùÒÔÎÒÈ¥µôHTML:FORM±êÇ©£¬ÖØж¨ÒåTOKEN»úÖÆ£¬·½·¨ÈçÏ£º
1¡¢´´ÐÂÐÂÀà,TokenProcess
public class TokenProcessor {
private long privious;//ÉÏ´ÎÉú³É±íµ¥±êʶºÅµÃʱ¼äÖµ
private static TokenProcessor instance=new TokenProcessor();
public static String FORM_TOKEN_KEY="FORM_TOKEN_KEY";
private TokenProcessor(){
}
public static TokenProcessor getInstance(){
return instance;
}
/**
* ÑéÖ¤ÇëÇóÖеñêʶºÅÊÇ·ñÓÐЧ£¬Èç¹ûÇëÇóÖÐµÄ±íµ¥±êʶÓ뵱ǰÓû§sessionÖеÄÏàͬ£¬·µ»Ø½á¹ûtrue=
*/
public synchronized boolean isTokenValid(HttpServletRequest request){
//δ±ÜÃâsession¶ÔÏó²»´æÔÚʱºò´´½¨Session¶ÔÏó
HttpSession session=request.getSession(false);
if(session==null){return false;}
String saved=(String)session.getAttribute(FORM_TOKEN_KEY);
if(saved==null){
return false;
}
St
Ïà¹ØÎĵµ£º
document.getElementById("flag")ÔÚieÖУ¬jspÖеÄÔªËØûÓÐidÖµ£¬ÓÐnameֵʱ£¬Ò²Äܲé³öÀ´£¬°´ÕÕnameÖµ²é¡£
µ«ÊÇÔÚfirefoxÖУ¬Èç¹ûûÓÐidÖµ£¬Ôò²é²»³öÀ´¡£ËùÒÔieÖУ¬nameºÍidÓÐʱͨÓ㻵«ÊÇfirefoxÖУ¬ÊÇÓÐÕâÑϸñÇø±ðµÄ¡£ ......
<html>
<head>
<title>marquee</title>
<style>
#marq {
width:500px;
height:100px;
border:1px solid red;
overflow:hidden;
}
#mar ......
JspÊÇÒ»¸öºÜÈÈÃŵĻ°Ì⣬µ«Èôó¶àÊýÈ˶¼Í·Í´µÄÊÇJSPÒ³ÃæÖеÄÂÒÂëÎÊÌ⣬±ÊÕßÉíÓÐÌå»á£»ÔøΪÁ˽â¾öÖÐÎÄÂÒÂëÎÊÌâÓôÃÆÁ˺ü¸Ì죬ÊÔÁ˺ܶ෽·¨¶¼²»ÐС£×îºóÔÚJSPרҵÈËÊ¿µÄ°ïÖúÏ£¬ÖÕÓÚ½â¾ö¡£Ö®ºó±ÊÕßÔø¶Ô´Ë×öÁËһЩСµÄÑо¿¡£
Ê×ÏÈÎÒÃÇÏÈÁ˽âÒ»ÏÂÎÊÌâµÄÔÒò¡£Ò»°ãÇé¿öÔÚÔÚÿ¸öJSPÒ³µÄÍ·²¿¶¼ÓÐÕâÑùÒ» ......
<%@ page info="Random Image Show"
pageEncoding="UTF-8" contentType="image/jpg"
autoFlush="true" buffer="16kb" session="false" import="java.io.FileInputStream"
%>< ......
À´Ô´ÓÚ¡¶Java¡¢javaEEÈí¼þ¹¤³Ìʦ¾ÍÒµÇóÖ°Êֲᡷ
1 HttpServletRequestÀàµÄrequest¶ÔÏ󣺴ú±íÇëÇó¶ÔÏó£¬Ö÷ÒªÓÃÓÚ½ÓÊÜ¿Í»§¶Ëͨ¹ýHTTPÐÒéÁ¬½Ó´«Êäµ½·þÎñÆ÷µÄÊý¾Ý¡£
2 HttpServletResponseÀàµÄresponse£º´ú±íÏìÓ¦¶ÔÏó£¬Ö÷ÒªÓÃÓÚÏò¿Í»§¶Ë·¢ËÍÊý¾Ý¡£
3 JspWriterÀàµÄout¶ÔÏó:Ö÷ÒªÓÃÓÚÏò¿Í»§¶ËÊä³öÊý¾Ý£¬OutµÄ»ùÀàÊÇJspWriter¡ ......