Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Jsp±à³Ì

 JAVA×ÛºÏÃæÊÔÌ⣺ҳÃæµÄץȡ¡¢½âÎö¡¢±£´æÊý¾Ý¿âºÍÉú³ÉHTMLµÄÒ³Ãæչʾ ÊÕ²Ø
´ÎÀý×Ó¿ÉÒÔÓÃÀ´Ñ§Ï°ÍøÂç±à³Ì£¬ÕýÔò±í´ïʽµÄʹÓ㬷ºÐÍ£¬Êý¾Ý¿âµÄ»ù±¾²Ù×÷µÈJAVA֪ʶ
ÎÊÌâÈçÏ£ºÀ´Ô´ÓÚÂÛ̳
http://topic.csdn.net/u/20090616/13/59aa4e2d-3752-45df-9c1b-c65c46c3e4d7.html
дһ¸öjspÒ³Ã棬·ÃÎÊʱÏÔʾ´ÓÏÂÃæµÄÒ³ÃæÌáÈ¡³öµÄÏúÊÛÉÌÏêϸÐÅÏ¢£º¼Û¸ñ¡¢ÔË·Ñ¡¢¾­Ïú
ÉÌ»ù±¾ÐÅÏ¢µÈ£¬²¢Ð´µ½Ò»¸öÊý¾Ý¿â±íÀï¡£
http://www.amazon.com/gp/offer-listing/B0012J52OC/
Êý¾ÝץȡµÄÎÊÌ⣬Éæ¼°µ½
1 ÓÃURLConnection ¶ÁÈ¡Ò³ÃæÐÅÏ¢£¬ÓÃhttpclientÒ²ÐÐ
2 ÓÃPattern ½âÎöÒ³Ãæ²¢Äõ½ÄãÒªµÄÐÅÏ¢
3 ÏÔʾÊý¾Ý
4 ´æÈëÊý¾Ý¿â
Õâ¸öÊÇÒ»¸ö×ۺϵĿ¼ÊÔ£¬Éæ¼°µÄ֪ʶÃæ±È½Ï¹ã¡£
1 ÎÒÕâÀïÖ»¸ø³ö¹Ø¼üµÄ²¿·Ö£¬Ê¹ÓÃjava³ÌÐòʵÏÖ£¬¶ø²»ÊÇJSPµÄ´úÂë¡£ÒÆÖ²¹¤×÷Çë×ÔÐÐÍê³É¡£
2 ÎÒʹÓÃ×Ô¼ºµÄÊý¾Ý¿âÁ¬½Ó£¬ÇëÌ滻ΪӦÓ÷þÎñÆ÷ÌṩµÄÊý¾ÝԴΪºÃ
3 ´úÂë·ÖÈý²¿·Ö£¬Êý¾Ý¿â½á¹¹£¬POJOÀàºÍÓ¦ÓóÌÐò£¬µ±È»»¹ÓÐÒ»¸ö¸¨ÖúÀ࣬ҲÊÇÎÒ×Ô¼ºÐ´µÄ
4 »¶Ó­¹âÁÙÀÏ×ÏÖñµÄJAVAÊÀ¼ÍÍø http://www.java2000.net, ºÇºÇ£¬¹ã¸æ·ÅÀïÃæÁË
Ò»¡¢Êý¾Ý¿â½á¹¹ AmazonGoods.sql ʹÓõÄÊÇMySQLµÄÊý¾Ý¿â
view plaincopy to clipboardprint?
-- ----------------------------  
-- Table structure for amazongoods  
-- ----------------------------  
CREATE TABLE `amazongoods` (  
  `id` int(11) NOT NULL AUTO_INCREMENT,  
  `price` decimal(10,0) NOT NULL,  
  `shipping` decimal(10,0) NOT NULL,  
  `Seller` text NOT NULL,  
  PRIMARY KEY (`id`)  
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; 
-- ----------------------------
-- Table structure for amazongoods
-- ----------------------------
CREATE TABLE `amazongoods` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `price` decimal(10,0) NOT NULL,
  `shipping` decimal(10,0) NOT NULL,
  `Seller` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
 
¶þ¡¢POJOÀà AmazonGoods.java
view plaincopy to clipboardprint?
package com.laozizhu.test.amazon;


Ïà¹ØÎĵµ£º

jsp Ìøת·½Ê½

ʹÓÃJSP´óÔ¼ÓÐÏÂÁÐÈýÖÖÌøת·½Ê½£º
1. response.sendRedirect();
2. response.setHeader("Location","");
3. £¼jsp:forward page="" /£¾
¾­¹ýÊÔÑéµÃµ½ÏÂÃæµÄһЩ¹æÔò£º
Ò». response.sendRedirect()
´ËÓï¾äÇ°²»ÔÊÐíÓÐout.flush()£¬Èç¹ûÓÐout.flush()£¬»áÓÐÒì³££º
java.lang.IllegalStateException: Can't send ......

½â¾önetbeansдjsp³öÏÖÖÐÎÄÂÒÂëµÄÎÊÌâ


jsp±íµ¥Ìá½»µÄÊý¾ÝÓÐÖÐÎÄʱ³öÏÖÂÒÂ룬²¢·Ç¶ÁÈ¡Êý¾Ý¿âÊý¾ÝºóÏÔʾÂÒÂ룬ÒÔÏÂÊǽâ¾öµÄ·½·¨¡£
netbeans´´½¨jspµÄÄ£°æÖÐÊÇ£º<%@page contentType="text/html" pageEncoding="UTF-8"%>£¬½«ÕâÐиijÉÒÔÏÂÕâÑù¾Í¿ÉÒÔÕý³£ÏÔʾÖÐÎÄ£º
<%@page language="java" pageEncoding=utf-8" %>
<%@page contentType=” ......

jspÂÒÂë³õ¼¶½â¾ö·½°¸

×î»ù±¾µÄÂÒÂëÎÊÌâ
Õâ¸öÂÒÂëÎÊÌâÊÇ×î¼òµ¥µÄÂÒÂëÎÊÌâ¡£Ò»°ãлá³öÏÖ¡£¾ÍÊÇÒ³Ãæ±àÂë²»Ò»Öµ¼ÖµÄÂÒÂë¡£
Html´úÂ룺
£¼%@ page language="java" pageEncoding="UTF-8"%£¾ 
£¼%@ page contentType="text/html;charset=iso8859-1"%£¾ 
£¼html£¾ 
£¼head£¾ 
£¼title ......

JSPÖÐÖ±½Óµ÷ÓÃSpring½Ó¹ÜµÄJAVABEAN

<%
    ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
    List stafflist = ((StaffDAO)ctx.getBean("StaffDAO")).findAll();
    request.setAttribute("stafflist",stafflist);
%> ......

jspÖÐ×÷ÓÃÓòscope¸ÅÄî

¼¸ºõËùÓеÄWeb¿ª·¢ÓïÑÔ¶¼Ö§³ÖSession¹¦ÄÜ£¬ServletÒ²²»ÀýÍâ¡£ Servlet/JSPÖеÄSession¹¦ÄÜÊÇͨ¹ý×÷ÓÃÓò(scope)Õâ¸ö¸ÅÄîÀ´ÊµÏֵġ£
×÷ÓÃÓò·ÖΪËÄÖÖ£¬·Ö±ðΪ£º
page
ÔÚµ±Ç°Ò³ÃæÓÐЧ(½öÓÃÓÚJSPÖÐ)
request
ÔÚµ±Ç°ÇëÇóÖÐÓÐЧ
session
ÔÚµ±Ç°»á»°ÖÐÓÐЧ
application
ÔÚËùÓÐÓ¦ÓóÌÐòÖÐÓÐЧ
ÊDz»ÊÇ¿´²»Ì«Ã÷°×£¿pageÒòΪ½ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ