´«ÖDz¥¿Íjavaѧϰ ½ÌÓý°ì¹«ÏµÍ³4
½ñÌì¼ÌÐø½ÌÓý°ì¹«ÏµÍ³µÄÂọ́¬½ñÌìÖ÷Òª½²µÄÊÇȨÏÞÄ£¿é£º
1. ¼¯³É spring-security ¿ò¼Ü
1). ¼ÓÈë spring-security µÄÁ½¸ö jar °ü
2). ÔÚ web.xml ÎļþÖмÓÈë¼ÓÈë spring-security ¿ò¼ÜµÄ¹ýÂËÆ÷
3). н¨ applicationContext-security.xml ÅäÖÃÎļþ,²¢ÇÒ°Ñ security ×÷ΪĬÈϵÄÃüÃû¿Õ¼ä,
²¢½«Æäµ¼Èëµ½ applicationContext.xml ÖÐ
4). Éè¼ÆÁìÓòÄ£ÐÍ:
Authority -- ȨÏÞ
Resource -- ×ÊÔ´
Role -- ½ÇÉ«
Employee -- Ìí¼Ó Set<Role> roleSet
ÊôÐÔ
Resource ºÍ Authority Ϊ¶à¶Ô¶àµÄ¶ÔÓ¦¹ØÏµ
Authority ºÍ Role Ϊ¶à¶Ô¶àµÄ¶ÔÓ¦¹ØÏµ
Role ºÍ Employee Ϊ¶à¶Ô¶àµÄ¶ÔÓ¦¹ØÏµ
ËùÒÔ»¹ÐèÒª 3 ¸ö¶îÍâµÄ¹ØÁª±í
** Êý¾Ý±íÉè¼Æ²Î¼û spring-security-2
5).
¢Ù. Ð޸ĵ±Ç°ÏµÍ³µÄ login.jsp Ò³Ãæ, ¸ÄΪ spring-security µÄµÇÂ¼Ò³Ãæ, ²¢ÇÒÔÚ
<http> ½ÚµãÖнøÐÐÅäÖÃ.
** ×¢Òâ:
spring-security ÔڵǼ³É¹¦ºó, ÀûÓà "ÖØ¶¨Ïò" תµ½ form-login ½Úµã¶ÔÓ¦µÄ
default-target-url ÊôÐÔ¶ÔÓ¦µÄÒ³Ãæ. ËùÒÔ²»ÄÜÖ±½Ó½«ÆäÅäÖÃΪ
Ïà¹ØÎĵµ£º
Java °´×Ö½Ú½ØÈ¡´øÓкº×ÖµÄ×Ö·û´®µÄ½â·¨£¬ÍøÉÏÓв»ÉÙÌÖÂÛ¡£ÕâÀïÎÒÒ²¸ø³öÒ»ÖÖÎÒ×Ô¼ºµÄ´¦Àí£¬»ù±¾ÔÀí»¹ÊÇͳ¼ÆÒª½ØÈ¡µÄ×Ö½ÚÊýÖÐÊDZíʾºº×ÖµÄ×Ö½ÚÊýÊÇ·ñÊÇżÊý¸ö£¬¼´ÊÇ·ñ¸ÕºÃ°üÀ¨ÁËÍêÕûµÄºº×Ö¡£
/**
* ±à³Ì£º±àдһ¸ö½ØÈ¡×Ö·û´®µÄº¯Êý£¬ÊäÈëΪһ¸ö×Ö·û´®ºÍ×Ö½ÚÊý£¬Êä³öΪ°´×Ö½Ú½ØÈ¡µÄ×Ö·û´®¡£ µ«ÊÇÒª±£Ö¤ºº×Ö²»±»½Ø°ë¸ ......
¡¡¡¡ÕâÀïËù˵µ½µÄJavaÖеÄÅÅÐò²¢²»ÊÇÖ¸²åÈëÅÅÐò¡¢Ï£¶ûÅÅÐò¡¢¹é²¢ÅÅÐòµÈ¾ßÌåµÄÅÅÐòËã·¨¡£¶øÊÇÖ¸Ö´ÐÐÕâЩÅÅÐòË㷨ʱ£¬±È½ÏÁ½¸ö¶ÔÏó“´óС”µÄ±È½Ï²Ù×÷¡£ÎÒÃǺÜÈÝÒ×Àí½âÕûÐ굀 i>j ÕâÑùµÄ±È½Ï·½Ê½£¬µ«µ±ÎÒÃǶԶà¸ö¶ÔÏó½øÐÐÅÅÐòʱ£¬ÈçºÎ±È½ÏÁ½¸ö¶ÔÏóµÄ“´óС”ÄØ£¿ÕâÑùµÄ±È½Ï stu1 > stu2 ÏÔÈ»ÊDz»¿É ......
Integer n1 = new Integer(1);
Integer n2 = new Integer(1);
System.out.println(n1==n2); // false
Integer n1 = new Integer(3);
Integer n2 = new Integer(3);
System.out.println(n1.equals(n2)); //true
equals()ĬÈÏÒ²ÊDZȽÏreference£¬µ«ÊÇJavaÖеÄclass¸²¸ÇÁËequals()·½·¨ ......
1. Ñ»·listÖеÄËùÓÐÔªËØÈ»ºóɾ³ýÖØ¸´
public static List removeDuplicate(List list) {
for ( int i = 0 ; i < list.size() - 1 ; i ++ ) {
for ( int j = list.size() - 1 ; j > i; j -- ) {
if (list.get(j).equals(list.get(i))) {
......
½ñÌì¼ÌÐøÙ¡ÀÏʦµÄ½ÌÓý°ì¹«ÏµÍ³µÄÂọ́º
1. Ô±¹¤Â¼ÈëµÄ·þÎñÆ÷¶ËµÄ¼òµ¥ÑéÖ¤:
1). ʹÓà struts µÄ validator ¿ò¼Ü
2). ÑéÖ¤¹æÔòͬä¯ÀÀÆ÷¶ËµÄ jQuery µÄ validator ÑéÖ¤.
3). ÒÔ email ×Ö¶ÎΪÀý, ÑéÖ¤ ......