国产一区二区三区在线视频,免费在线黄色电影,免费在线黄色网址http://www.aygfsteel.com/cool2009/CommentsRSS.aspx專注于java相關(guān)技術(shù).zh-cnTue, 17 Dec 2013 20:16:44 GMTTue, 17 Dec 2013 20:16:44 GMTcnblogsre: Struts1.2 驗(yàn)證用戶是否登陸 兩種方法(轉(zhuǎn))http://www.aygfsteel.com/cool2009/archive/2012/02/03/277926.html#369331v和vjv和vjFri, 03 Feb 2012 08:46:00 GMThttp://www.aygfsteel.com/cool2009/archive/2012/02/03/277926.html#369331

v和vj 2012-02-03 16:46 發(fā)表評(píng)論
]]>
re: jsp頁(yè)面通過 request對(duì)象直接獲取 struts2 Action的變量的值。http://www.aygfsteel.com/cool2009/archive/2011/12/15/266117.html#366421serisboyserisboyThu, 15 Dec 2011 04:27:00 GMThttp://www.aygfsteel.com/cool2009/archive/2011/12/15/266117.html#366421這個(gè)簡(jiǎn)單實(shí)用!

serisboy 2011-12-15 12:27 發(fā)表評(píng)論
]]>
re: button/input鏈接方式全攻略http://www.aygfsteel.com/cool2009/archive/2011/10/24/264835.html#361865楊先生楊先生Mon, 24 Oct 2011 02:52:00 GMThttp://www.aygfsteel.com/cool2009/archive/2011/10/24/264835.html#361865

楊先生 2011-10-24 10:52 發(fā)表評(píng)論
]]>
re: Struts1.2 驗(yàn)證用戶是否登陸 兩種方法(轉(zhuǎn))http://www.aygfsteel.com/cool2009/archive/2011/06/02/277926.html#351612liangwuliangwuThu, 02 Jun 2011 09:25:00 GMThttp://www.aygfsteel.com/cool2009/archive/2011/06/02/277926.html#351612package com.gpPlatform.utils;
/* 檢驗(yàn)管理員是否已經(jīng)登錄及是否擁有權(quán)限的過濾器*/
import java.util.List;
import java.util.Map;
import java.util.Iterator;
import java.util.Set;
import java.util.Date;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.gpPlatform.IConstants;
import com.gpPlatform.services.ResourceDao;
import com.gpPlatform.forms.AdminForm;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class SecurityCheckFilter implements Filter{

private List<String> notFilterURL;

private ResourceDao resourcedao= null;

private Map<String,String> permits;

private String getPermitId(String action_url){ //根據(jù)Map獲取動(dòng)作資源id
this.permits= resourcedao.getResourceList();
String rid_visited="NO_MATCH";
Set<String> key = permits.keySet(); //獲取權(quán)限集map鍵集合
for(Iterator<String> it=key.iterator();it.hasNext();){
String k= it.next();
if(k.equals(action_url)){
rid_visited=permits.get(k);
break;
}
}
return rid_visited;
}

private boolean isPIdExist(AdminForm aform,String rid,boolean init){
boolean flag=!init;
if(!flag){
String[] pArray= aform.getPermitList();
for(String pid:pArray){
System.out.println(pid);
if(pid.equals(rid))
return true;
}
}

return flag;
}

public void init(FilterConfig filterconfig) throws ServletException{ //獲取系統(tǒng)context以傳遞屬性
String configpath= "F:/tomcat 5.5.2/Tomcat 5.5/webapps/gpplatform/WEB-INF/appContext.xml";
ApplicationContext context= new FileSystemXmlApplicationContext(configpath);
IConstants iconstant=(IConstants)context.getBean("constants");
resourcedao= (ResourceDao)context.getBean("resourcedao"); //不可setter直接注入,filter servlet容器先于spring生成
notFilterURL = iconstant.getNotFilterURL();

System.out.println("There are "+notFilterURL.size()+" urls free of filtering");
}

public void doFilter(ServletRequest req, ServletResponse res, //改寫doFilter方法檢驗(yàn)
FilterChain chain)throws IOException, ServletException{

HttpServletRequest request= (HttpServletRequest) req;
HttpSession session= request.getSession();
AdminForm aform= (AdminForm)session.getAttribute(IConstants.CURR_ADMIN_KEY);

boolean flag1= true;
boolean flag2= true;

String str= request.getServletPath();

if(str.indexOf(".jsp")!=-1||str.indexOf(".do")!=-1){
for(String url:notFilterURL){
if(str.equals(url)){
flag1= false;
break;
}
}
}
else
flag1= false;

if(str.indexOf(".do")!=-1&&request.getParameter("method")!=null&&!request.getParameter("method").equals("readInfo"))
str += "?method="+request.getParameter("method"); //獲取一般的動(dòng)作參數(shù)
else
flag2= false;

System.out.println("action str is "+str+" "+flag1+" "+flag2);
if(flag1){
if(aform==null){ //對(duì)不在免除過濾路徑集合中的url進(jìn)行過濾
System.out.println("<=======You haven't Logged in yet!=======>"+(new Date()).toString());
request.setAttribute(IConstants.LOGIN_ERROR_KEY, "抱歉,您還沒有登陸本系統(tǒng)%>_<%");
request.getRequestDispatcher("/adminLog.jsp").forward(req, res);
}
else{
if(!this.isPIdExist(aform, this.getPermitId(str), flag2)){
System.out.println("<======You don't hava such permit!======>"+(new Date()).toString());
request.setAttribute(IConstants.PERMIT_ERROR_KEY,"抱歉,您不具備當(dāng)前功能的權(quán)限⊙﹏⊙ ");
request.getRequestDispatcher("/errorPage.jsp").forward(req, res);
}
else{
chain.doFilter(req, res);
return;
}
}
}
else{
chain.doFilter(req, res);
return;
}
}

public void destroy(){}
}

liangwu 2011-06-02 17:25 發(fā)表評(píng)論
]]>
re: jsp中獲取前一個(gè)頁(yè)面的url包括參數(shù)http://www.aygfsteel.com/cool2009/archive/2011/05/13/278156.html#3501917u76tu7u76tuFri, 13 May 2011 09:38:00 GMThttp://www.aygfsteel.com/cool2009/archive/2011/05/13/278156.html#350191

7u76tu 2011-05-13 17:38 發(fā)表評(píng)論
]]>
re: jsp中獲取前一個(gè)頁(yè)面的url包括參數(shù)http://www.aygfsteel.com/cool2009/archive/2011/05/13/278156.html#3501907u76tu7u76tuFri, 13 May 2011 09:37:00 GMThttp://www.aygfsteel.com/cool2009/archive/2011/05/13/278156.html#350190

7u76tu 2011-05-13 17:37 發(fā)表評(píng)論
]]>
re: Struts1.2 驗(yàn)證用戶是否登陸 兩種方法(轉(zhuǎn))http://www.aygfsteel.com/cool2009/archive/2011/05/05/277926.html#349609liangwuliangwuThu, 05 May 2011 08:16:00 GMThttp://www.aygfsteel.com/cool2009/archive/2011/05/05/277926.html#349609
以上是自己一個(gè)web工程的filter。通過設(shè)置一個(gè)不被過濾的url集合notFilterURL,實(shí)現(xiàn)在struts1中沒有的interceptor所完成的功能。




liangwu 2011-05-05 16:16 發(fā)表評(píng)論
]]>
re: Struts1.2 驗(yàn)證用戶是否登陸 兩種方法(轉(zhuǎn))http://www.aygfsteel.com/cool2009/archive/2011/05/05/277926.html#349608liangwuliangwuThu, 05 May 2011 08:08:00 GMThttp://www.aygfsteel.com/cool2009/archive/2011/05/05/277926.html#349608/* 檢驗(yàn)管理員是否已經(jīng)登錄的過濾器*/
import java.util.List;
import java.util.ArrayList;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class LoginCheckFilter implements Filter{

private static List<String> notFilterURL;

@SuppressWarnings("static-access")
public void init(FilterConfig filterconfig) throws ServletException{
this.notFilterURL= new ArrayList<String>();
notFilterURL.add("/gpplatform/adminLog.jsp");
notFilterURL.add("/gpplatform/errorPage.jsp");
notFilterURL.add("/gpplatform/testJDBC.jsp");
notFilterURL.add("/gpplatform/yzm.jsp");
notFilterURL.add("/gpplatform/script/trim.js");
}

public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain)throws IOException, ServletException{
HttpServletRequest request= (HttpServletRequest) req;
HttpServletResponse response= (HttpServletResponse) res;
HttpSession session= request.getSession();

boolean flag= true;
String str= "/gpplatform"+request.getServletPath();

for(String url:notFilterURL){
if(str.equals(url)){
flag= false;
break;
}
}

System.out.println(str+" "+flag);

if(flag&&session.getAttribute("curr_admin")==null){
//對(duì)不在notFilterURL集合路徑中的url進(jìn)行過濾
System.out.println("<=====You haven't logged in!=====>");
response.sendRedirect("/gpplatform/adminLog.jsp");
}
else{
chain.doFilter(req, res);
return;
}
}

public void destroy(){}
}

liangwu 2011-05-05 16:08 發(fā)表評(píng)論
]]>
re: Struts1.2 驗(yàn)證用戶是否登陸 兩種方法(轉(zhuǎn))http://www.aygfsteel.com/cool2009/archive/2011/05/05/277926.html#349596liangwuliangwuThu, 05 May 2011 06:59:00 GMThttp://www.aygfsteel.com/cool2009/archive/2011/05/05/277926.html#349596

liangwu 2011-05-05 14:59 發(fā)表評(píng)論
]]>
re: 分享Java面試中遇到的一些經(jīng)典算法題目http://www.aygfsteel.com/cool2009/archive/2010/07/31/268508.html#327666ttSat, 31 Jul 2010 14:14:00 GMThttp://www.aygfsteel.com/cool2009/archive/2010/07/31/268508.html#327666beginIndex>endIndex
這個(gè)是否沒用

t 2010-07-31 22:14 發(fā)表評(píng)論
]]>
re: 在jsp頁(yè)面判斷struts2 變量的值[未登錄]http://www.aygfsteel.com/cool2009/archive/2010/06/06/266478.html#322918yangyangSun, 06 Jun 2010 14:33:00 GMThttp://www.aygfsteel.com/cool2009/archive/2010/06/06/266478.html#322918

yang 2010-06-06 22:33 發(fā)表評(píng)論
]]>
re: Struts1.x中 bean:write format 屬性格式化輸出日期,數(shù)字(轉(zhuǎn))http://www.aygfsteel.com/cool2009/archive/2009/12/16/268445.html#306114sdfsfsdfsfWed, 16 Dec 2009 03:03:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/12/16/268445.html#306114

sdfsf 2009-12-16 11:03 發(fā)表評(píng)論
]]>
re: struts2的ONGL標(biāo)簽詳解(轉(zhuǎn)載)[未登錄]http://www.aygfsteel.com/cool2009/archive/2009/11/03/266477.html#300857三少三少Tue, 03 Nov 2009 02:49:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/11/03/266477.html#300857

三少 2009-11-03 10:49 發(fā)表評(píng)論
]]>
re: 文字連接用javascript 確認(rèn)提示框 提示用戶是否要進(jìn)行刪除操作http://www.aygfsteel.com/cool2009/archive/2009/10/26/265933.html#299736西鐵城西鐵城Mon, 26 Oct 2009 02:35:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/10/26/265933.html#299736

西鐵城 2009-10-26 10:35 發(fā)表評(píng)論
]]>
re: 分享Java面試中遇到的一些經(jīng)典算法題目http://www.aygfsteel.com/cool2009/archive/2009/10/17/268508.html#298670yxyxSat, 17 Oct 2009 04:06:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/10/17/268508.html#298670

yx 2009-10-17 12:06 發(fā)表評(píng)論
]]>
re: java產(chǎn)生隨機(jī)數(shù)的幾種方式http://www.aygfsteel.com/cool2009/archive/2009/10/14/259882.html#298171GGWed, 14 Oct 2009 03:16:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/10/14/259882.html#298171

G 2009-10-14 11:16 發(fā)表評(píng)論
]]>
re: 分享Java面試中遇到的一些經(jīng)典算法題目http://www.aygfsteel.com/cool2009/archive/2009/09/15/268508.html#295159萬其萬其Tue, 15 Sep 2009 07:52:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/09/15/268508.html#295159

萬其 2009-09-15 15:52 發(fā)表評(píng)論
]]>
re: 陳安之激勵(lì)名言十一句---分享給大家---學(xué)技術(shù)的同時(shí)思考一下人生[未登錄]http://www.aygfsteel.com/cool2009/archive/2009/08/13/266612.html#290992過客過客Thu, 13 Aug 2009 06:29:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/08/13/266612.html#290992

過客 2009-08-13 14:29 發(fā)表評(píng)論
]]>
re: 解決ajax post請(qǐng)求亂碼 ie、Firefox測(cè)試通過[未登錄]http://www.aygfsteel.com/cool2009/archive/2009/07/05/285299.html#285530lveyolveyoSun, 05 Jul 2009 01:56:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/07/05/285299.html#285530
而且response.serContentType("text/html;charset=utf-8");是設(shè)置返回?cái)?shù)據(jù)的編碼類型的,和取得數(shù)據(jù)沒關(guān)系,應(yīng)該用request.setCharacterEncoding("UTF-8");方法,也就不用轉(zhuǎn)碼了。

lveyo 2009-07-05 09:56 發(fā)表評(píng)論
]]>
re: 修改mysql root 密碼[未登錄]http://www.aygfsteel.com/cool2009/archive/2009/07/04/264251.html#285431小毅小毅Fri, 03 Jul 2009 18:08:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/07/04/264251.html#285431然后 出現(xiàn)Enter Password:讓你輸入舊密碼連接mysql數(shù)據(jù)進(jìn)行更改
回車 更改密碼成功!


小毅 2009-07-04 02:08 發(fā)表評(píng)論
]]>
re: 解決ajax post請(qǐng)求亂碼 ie、Firefox測(cè)試通過[未登錄]http://www.aygfsteel.com/cool2009/archive/2009/07/04/285299.html#285430小毅小毅Fri, 03 Jul 2009 17:49:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/07/04/285299.html#285430或者自己手動(dòng)轉(zhuǎn)碼new String(字符串.getBytes("原編碼方式"),"支持中文的編碼方式,如:UTF-8 GBK GB2312 GB18030")
亂碼問題老問題了。。哎。。。

小毅 2009-07-04 01:49 發(fā)表評(píng)論
]]>
re: 在jsp頁(yè)面判斷struts2 變量的值[未登錄]http://www.aygfsteel.com/cool2009/archive/2009/06/24/266478.html#283963小魚小魚Wed, 24 Jun 2009 08:39:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/06/24/266478.html#283963


小魚 2009-06-24 16:39 發(fā)表評(píng)論
]]>
re: 分享Java面試中遇到的一些經(jīng)典算法題目http://www.aygfsteel.com/cool2009/archive/2009/06/03/268508.html#279739zdkzdkWed, 03 Jun 2009 01:30:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/06/03/268508.html#279739

zdk 2009-06-03 09:30 發(fā)表評(píng)論
]]>
re: jsp中獲取前一個(gè)頁(yè)面的url包括參數(shù)http://www.aygfsteel.com/cool2009/archive/2009/06/01/278156.html#279321racherracherSun, 31 May 2009 23:53:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/06/01/278156.html#279321

racher 2009-06-01 07:53 發(fā)表評(píng)論
]]>
re: jsp中獲取前一個(gè)頁(yè)面的url包括參數(shù)http://www.aygfsteel.com/cool2009/archive/2009/05/31/278156.html#279308lpz@21cn.comlpz@21cn.comSun, 31 May 2009 14:59:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/05/31/278156.html#279308

lpz@21cn.com 2009-05-31 22:59 發(fā)表評(píng)論
]]>
re: jsp中獲取前一個(gè)頁(yè)面的url包括參數(shù)http://www.aygfsteel.com/cool2009/archive/2009/05/31/278156.html#279250Sun, 31 May 2009 09:51:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/05/31/278156.html#279250

2009-05-31 17:51 發(fā)表評(píng)論
]]>
re: jsp中獲取前一個(gè)頁(yè)面的url包括參數(shù)http://www.aygfsteel.com/cool2009/archive/2009/05/31/278156.html#279120zhannglezhanngleSat, 30 May 2009 16:06:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/05/31/278156.html#279120

zhanngle 2009-05-31 00:06 發(fā)表評(píng)論
]]>
re: Struts1.2 驗(yàn)證用戶是否登陸 兩種方法(轉(zhuǎn))http://www.aygfsteel.com/cool2009/archive/2009/05/29/277926.html#278907zhongzhongFri, 29 May 2009 05:34:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/05/29/277926.html#278907

zhong 2009-05-29 13:34 發(fā)表評(píng)論
]]>
re: jsp中獲取前一個(gè)頁(yè)面的url包括參數(shù)[未登錄]http://www.aygfsteel.com/cool2009/archive/2009/05/28/278156.html#278357dydyThu, 28 May 2009 15:09:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/05/28/278156.html#278357

dy 2009-05-28 23:09 發(fā)表評(píng)論
]]>
re: jsp中獲取前一個(gè)頁(yè)面的url包括參數(shù)http://www.aygfsteel.com/cool2009/archive/2009/05/27/278156.html#278277劉杰劉杰Wed, 27 May 2009 15:16:00 GMThttp://www.aygfsteel.com/cool2009/archive/2009/05/27/278156.html#278277

劉杰 2009-05-27 23:16 發(fā)表評(píng)論
]]>
主站蜘蛛池模板: 乐东| 大足县| 互助| 义马市| 澳门| 托克逊县| 营山县| 清涧县| 金沙县| 雅安市| 新郑市| 漠河县| 屏东县| 怀集县| 当阳市| 鸡西市| 新田县| 扬中市| 巨鹿县| 仪征市| 宝鸡市| 隆尧县| 神农架林区| 通渭县| 木兰县| 巴东县| 墨玉县| 阿拉善右旗| 灵山县| 泸水县| 西乌| 马边| 民和| 依安县| 马鞍山市| 徐州市| 河东区| 邢台市| 平塘县| 德州市| 莆田市|