Java¹ýÂËÆ÷ÑéÖ¤µÇ¼Óû§
1.Ê×ÏÈдһ¸öȨÏÞ¹ýÂËfilterÀà,ʵÏÖFilter½Ó¿Ú
/*Ê×ÏÈдһ¸öȨÏÞ¹ýÂËfilter*/
import javax.servlet.Filter;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.FilterChain;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
public class RightFilter
implements Filter {
public void init(FilterConfig filterConfig) throws ServletException {
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
HttpSession session = req.getSession(true);
String path = req.getRequestURI();
//´ÓsessionÀïÈ¡µÄÓû§ÃûÐÅÏ¢
String username = (String) session.getAttribute("username");
for (int i = 0; i < Constants.NoFilter_Pages.length; i++) {
if (path.indexOf(Constants.NoFilter_Pages[i]) > -1) {
chain.doFilter(req, res);
return;
}
}
//ÅжÏÈç¹ûûÓÐÈ¡µ½Óû§ÐÅÏ¢,¾ÍÌø×ªµ½µÇÂ½Ò³Ãæ
if (username == null || "".equals(username)) {
//Ìø×ªµ½µÇÂ½Ò³Ãæ
res.sendRedirect(" http://"+req.getHeader("Host")+"/login.jsp ");//ÕâÀïÊÇ·µ»ØÓòÃûµÄ¸ùĿ¼µØÖ·£¬ÈôÖ±½Ó·µ»Øµ±Ç°µÄĿ¼ÏµÄÎļþ£¬ÔòÓÃres.sendRedirect("/login.jsp")
}
else {
//ÒѾµÇ½,¼ÌÐø´
Ïà¹ØÎĵµ£º
Ò» JSmooth
1.³öÆ·
Jsmooth,Sourceforge.net
2. ÀàÐÍ
free
3. ÏÂÔØ
http://jsmooth.sourceforge.net/download.php
4. ²½Öè
a)ÀûÓÃEclipse½«ËùÐèÒªµÄÖ÷Àà´ò³É¿É¶ÀÁ¢ÔËÐеÄjar°ü£¬×¢ÒâÌí¼ÓmanifestÊôÐÔºÍMainClass¡£
b)н¨Ò»¸öJsmooth¹¤³Ì
c) ÔÚsketlonÖÐÑ¡Ôñ“Console“ »òÕß “Windowe ......
Web¿ª·¢Öо³£Óõ½µÄһЩÃû´Ê£¬°´Í¬¹¦ÄÜÀàÐ͵ĽøÐзÖ×飺
1.±êÇ©£ºWebWork±êÇ©¡¢JSTL¡¢JSP±êÇ©
2.AOP À¹½ØÆ÷ ¹ýÂËÆ÷ ¼àÌýÆ÷ УÑéÆ÷
3.ÃæÏò½Ó¿Ú ÃæÏòÇÐÃæ ¿ØÖÆ·´×ª ÒÀÀµ×¢Èë
4.µ¥Ì¬Ä£Ê½ DAOģʽ ×°ÊÎģʽ
5.»º´æ£ºÊý¾Ý»º´æ ·þÎñÆ÷¶Ë»º´æ ¿Í»§¶Ë»º´æ
6.ORM EJB[ÈýÖÖBean]
7.JMS
8.MVC¿ª·¢Ä£Ê½
9.W ......
ÓÐʱ£¬ÎÒÃÇÔÚдһ¸ö¹¹Ô캯Êýʱ£¬¾³£ÒòΪËü°üº¬ÖÚ¶àµÄ²ÎÊý¶ø¿àÄÕ,Õâʱ¿ÉÒÔ¿¼ÂÇÓÃBuilderģʽÀ´´´½¨¶ÔÏó¡£
È磬ÎÒÃÇÒªÉè¼ÆÒ»¸öÓªÑø³É·ÝµÄÀ࣬°üº¬ÄÜÁ¿£¬µ°°×ÖÊ£¬Ö¬·¾£¬¸Æ£¬Ìú£¬Ð¿£¬Î¬ÉúËØA, άÉúËØB1 ... µÈ£¬µ«ÔÚ¹¹ÔìµÄʱºò£¬²»Ò»¶¨Ã¿´Î¶¼ÐèÒªÕâЩ²ÎÊý£¬Èç¸Æ£¬Ìú£¬Ð¿ºÍάÉúËØµÈÊÇ¿ÉÑ¡µÄ£¬ÎªÁËÊÊÓ¦¶àÖÖ¿ÉÄܵĴîÅ䣬±È ......
package testPackage;
class Test {
public static void main(String[] args) {
String hello = "Hello", lo = "lo";
System.out.print((hello == "Hello") + " ");
System.out.print((Other.hello == hello) + " ");
System.out.print((other.Other.hello == hello) + " ");
System.out.print((hello == ("Hel"+"lo ......
Ò»¡¢Ê¹ä¯ÀÀÆ÷²»»º´æÒ³ÃæµÄ¹ýÂËÆ÷
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* ÓÃÓÚµÄʹ Browser ²» ......