´«ÖDz¥¿Í——JSP£¨ËÄ£©¹¤³§Ä£Ê½
Ò»£º¹¤³§Ä£Ê½³öÏÖµÄÔÒò
Ò»°ãÉè¼Æģʽ£º
view plaincopy to clipboardprint?
interface Fruit{
public void eat();
}
class Apple implements Fruit{
public void eat(){
System.out.println("**³ÔÆ»¹û**") ;
}
}
class Orange implements Fruit{
public void eat(){
System.out.println("**³ÔéÙ×Ó**") ;
}
}
public class FactoryDemo01{
public static void main(String args[]){
Fruit f = new Apple();
f.eat();
}
}
interface Fruit{
public void eat();
}
class Apple implements Fruit{
public void eat(){
System.out.println("**³ÔÆ»¹û**") ;
}
}
class Orange implements Fruit{
public void eat(){
System.out.println("**³ÔéÙ×Ó**") ;
}
}
public class FactoryDemo01{
public static void main(String args[]){
Fruit f = new Apple();
f.eat();
}
}
ÔÚÕâÖÖÆÕͨµÄ±àÂ뷽ʽÖУ¬ºóÐøµÄÀ©Õ¹¹¦Äܽ«ÊÇÔÖÄÑ£¬µ±ÓÐеÄË®¹ûÀàÔö¼Óʱ£¬±ØÐë·³öÔ´Âë½øÐÐÐ޸ģ¬Õâ¶ÔÓÚÒ»¸öÅ
Ïà¹ØÎĵµ£º
²»Ëµ·Ï»°ÁË£¬¿´ÏÂÃæµÄÀý×Ó°É(ÀûÓÃstructsʵÏÖ£©£º
ÔÚWEB£INFÏÂÓÐÁ½¸öÒ³Ã棺 a.jsp ºÍ b.jsp £¬ ÏÖÔÚҪʵÏÖ´Óa.jspÁ¬½Óµ½b.jsp
ÔÚa.jspÖУº
<html:link action= ......
Ò»£¬jsp³öÏֵĵÄÔÒò
¿´Á½¶Î´úÂëµÄ¶Ô±È
1 servletʵÏÖ
public class Welcome extends HttpServlet {
int num = 1;
public void doGet(HttpServletRequest request,
&nbs ......
Ò».request¶ÔÏó
¿Í»§¶ËµÄÇëÇóÐÅÏ¢±»·â×°ÔÚrequest¶ÔÏóÖУ¬Í¨¹ýËü²ÅÄÜÁ˽⵽¿Í»§µÄÐèÇó£¬È»ºó×ö³öÏìÓ¦¡£ËüÊÇHttpServletRequestÀàµÄʵÀý¡£
µ±request¶ÔÏó»ñÈ¡Óû§Ìá½»µÄºº×Ö×Ö·ûʱ£¬»á²úÉúÂÒÂ룬ÓÉÏÂÃæµÄ·½·¨¿ÉÒÔ½â¾ö£º
¡¡¡¡ Sting s2 = new String(s1.getBytes("iso8859-1"),"GB2312") ......
ÒòΪҪʵÏÖÒ»¸öWebServer£¬Ð´ÍêÁËÒ»¸ö¼òµ¥µÄWebServerºóÍ»·¢ÆæÏ룬ºÎ²»ÊµÏÖÒ»¸öJSP µÄWebServerÄØ£¿
ÓÐÁËÕâ¸öÏë·¨ºó£¬¾Í¿ªÊ¼¿¼ÂÇJSPµÄʵÏÖÔÀí£¬ÆäʵJSPµÄʵÏÖÒ²ºÜ¼òµ¥£¬Ëµ°×Á˾ÍÊǽ«Æäת»»³ÉÒ»¸öJavaÎļþ£¬ÔÙ¶ÔÕâ¸öJavaÎļþ½øÐбàÒ룬Éú³ÉÀàÎļþ£¬½Ó×ÅÔÙÓÉ·þÎñÆ÷ʹÓÃÕâ¸öÀàÎļþ¡£´Ó×ÜÌåÉÏ·Ö£¬¿ÉÒÔ½«JSPÎļþµÄÄÚÈÝ»®·ÖΪÁ½ ......
Ò» MVCÉè¼ÆģʽµÄ¸ÅÄî
MVC±¾À´ÊÇ´æÔÚÓÚDesktop³ÌÐòÖеģ¬MÊÇÖ¸Êý¾ÝÄ£ÐÍ£¬VÊÇÖ¸Óû§½çÃ棬CÔòÊÇ¿ØÖÆÆ÷¡£Ê¹ÓÃMVCµÄÄ¿µÄÊǽ«MºÍVµÄʵÏÖ´úÂë·ÖÀ룬´Ó¶øʹͬһ¸ö³ÌÐò¿ÉÒÔʹÓò»Í¬µÄ±íÏÖÐÎʽ¡£±ÈÈçÒ»Åúͳ¼ÆÊý¾ÝÄã¿ÉÒÔ·Ö±ðÓÃÖù״ͼ¡¢±ýͼÀ´±íʾ¡£C´æÔÚµÄÄ¿µÄÔòÊÇÈ·±£MºÍVµÄͬ²½£¬Ò»µ©M¸Ä±ä£¬VÓ¦¸Ãͬ²½¸üС£& ......