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

jspÄÚÖöÔÏó

1.request¶ÔÏó
  ¸Ã¶ÔÏó·â×°ÁËÓû§Ìá½»µÄÐÅÏ¢£¬Í¨¹ýµ÷ÓøöÔÏóµÄÏìÓ¦µÄ·½·¨¿ÉÒÔ»ñÈ¡Óû§Ìá½»µÄÐÅÏ¢¡£
  µ±request¶ÔÏó»ñÈ¡Óû§Ìá½»µÄºº×Ö×Ö·ûʱ£¬»á²úÉúÂÒÂ룬ÓÉÏÂÃæµÄ·½·¨¿ÉÒÔ½â¾ö£º
  Sting  s2 = new   String(s1.getBytes("iso8859-1"),"GB2312")½øÐÐת»»¡£
 request³£Óõķ½·¨£º
 
 1.request.getParameter("name"); »ñÈ¡±íµ¥Ìá½»µÄÐÅÏ¢
 2.request.getProtocol();        »ñÈ¡¿Í»§¶ËʹÓõÄЭÒé
 3.request.getServletPath();     »ñÈ¡¿Í»§Ìá½»ÐÅÏ¢µÄÒ³Ãæ
 4.request.getMethod();          »ñÈ¡¿Í»§Ìá½»ÐÅÏ¢µÄ·½·¨
 5.request.getHeader();          »ñÈ¡httpÏûϢͷÖÐÊôÐÔµÄÖµ È磺accept¡¢accept-encoding¡¢host
 6.request.getRemoteAddr();      »ñÈ¡¿Í»§µÄipµØÖ·
 7.request.getRemoteHost();      »ñÈ¡¿Í»§»úµÄÃû³Æ
 8.request.getServerName();      »ñÈ¡·þÎñÆ÷µÄÃû³Æ
 9.request.getServerPort();      »ñÈ¡·þÎñÆ÷µÄ¶Ë¿ÚºÅ
 10.request.getParameterNames(); »ñÈ¡¿Í»§¶ËÌá½»µÄËùÓвÎÊýµÄÃû×Ö
 response¶ÔÏóµÄʹÓ÷½·¨
 ¶Ô¿Í»§µÄÇëÇó×÷³ö¶¯Ì¬µÄÏìÓ¦£¬Ïò¿Í»§¶Ë·¢ËÍÊý¾Ý
1.¶¯Ì¬ÏìÓ¦contentTypeÊôÐÔ
 µ±Ò»¸öÓû§·ÃÎÊÒ»¸öJSPÒ³Ãæʱ£¬Èç¹û¸ÃÒ³ÃæÓÃpageÖ¸ÁîÉèÖÃÒ³ÃæµÄcontentTypeÊôÐÔʱtext/html£¬ÄÇôJSPÒýÇ潫°´ÕÕÕâ¸öÊôÐÔÖµ×ö³ö·´Ó¦¡£Èç¹ûÒª¶¯Ì¬¸Ä±äÕâ»»¸öÊôÐÔÖµÀ´ÏìÓ¦¿Í»§£¬¾ÍÐèҪʹÓÃResponse¶ÔÏóµÄsetContentType(String s)·½·¨À´¸Ä±äcontentTypeµÄÊôÐÔÖµ¡£
¸ñʽ£ºresponse.setContentType(String s);
²ÎÊýs¿ÉÈ¡text/html,application/x-msexcel,application/mswordµÈ¡£
2.ResponseÖض¨Ïò
ÔÚijЩÇé¿öÏ£¬µ±ÏìÓ¦¿Í»§Ê±£¬ÐèÒª½«¿Í»§ÖØÐÂÒýµ¼ÖÁÁíÒ»¸öÒ³Ã棬¿ÉÒÔʹÓÃResponseµÄsendRedirect(URL)·½·¨ÊµÏÖ¿Í»§µÄÖض¨Ïò¡£ÀýÈ磺
response.sendRedirect("index.jsp");
3.session¶ÔÏó
 Ê²Ã´ÊÇsession¶ÔÏó£¿
 ËüÔÚµÚÒ»¸öjspÒ³Ãæ±»¼ÓÔØʱ×Ô¶¯´´½¨£¬Íê³É»á»°ÆÚ¹ÜÀí£¬´ÓÒ»¸ö¿Í»§´ò¿ªä¯ÀÀÆ÷²¢Á¬½Ó·þÎñÆ÷¿ªÊ¼£¬µ½¿Í»§¹Ø±Õä¯ÀÀ


Ïà¹ØÎĵµ£º

JSPÒ³ÃæÌøת´óÈ«

JSPÖеÄÌøת£º
(1). forward()·½·¨
    ʹÓõ½javax.servlet.RequestDispatcherÀà
    RequestDispatcher rd = getServletContext().getRequestDispatcher("url");
    rd.forward(requestVar,requestVar); //´«µÝservletµÄÈë¿Ú²ÎÊý
    /*forwardº ......

jspʵÏÖÎļþÏÂÔØÓëÖÐÎÄÎļþÃûÂÒÂëÎÊÌâ½â¾ö

ÎÊÌâÈçÏ£º
֮ǰ,д¹ýÒ»¸öDownload.jspÎļþ,¿ÉÒÔ½â¾öÏÂÔØÎļþÂÒÂëÎÊÌâ(ÖîÈç:DOC,XSLÎļþµÈµÈ).
ºóÀ´·¢ÏÖ,Óöµ½ÖÐÎÄÃûµÄÎļþµÄʱºò,ÎļþÏÂÔؽ«»á±¨´í~~~~
½ñÌì,ͨ¹ý¸ÄдԭDownload.jspÎļþÒѾ­³¹µ×½â¾öÁËÕâ¸öÎÊÌâ~
ÏÖÔÚ,°ÑÒ»ÕûÌ×µÄÎļþÉÏ´«ÏÂÔصķ½·¨¸øÌù³öÀ´~~~ÒÔ±ã´ó¼Ò½è¼ø!~!~!~!~! 
×÷Õß:¹Å°£¼°·¨ÀÏ
download ......

Jsp·½Ãæ

1¡¢forward ºÍredirectµÄÇø±ð
´ð£ºforwardÊÇ·þÎñÆ÷ÇëÇó×ÊÔ´£¬·þÎñÆ÷Ö±½Ó·ÃÎÊÄ¿±êµØÖ·µÄURL£¬°ÑÄǸöURLµÄÏìÓ¦ÄÚÈݶÁÈ¡¹ýÀ´£¬È»ºó°ÑÕâЩÄÚÈÝÔÙ·¢¸øä¯ÀÀÆ÷£¬ä¯ÀÀÆ÷¸ù±¾²»ÖªµÀ·þÎñÆ÷·¢Ë͵ÄÄÚÈÝÊÇ´ÓÄĶùÀ´µÄ£¬ËùÒÔËüµÄµØÖ·À¸Öл¹ÊÇÔ­À´µÄµØÖ·¡£
    redirect¾ÍÊÇ·þÎñ¶Ë¸ù¾ÝÂß¼­,·¢ËÍÒ»¸ö״̬Âë,¸æËßä ......

Jsp Á¬½Ó mySQL¡¢Oracle Êý¾Ý¿â±¸Íü

Jsp Á¬½Ó mySQL¡¢Oracle Êý¾Ý¿â±¸Íü
2009-12-15 16:47
Jsp »·¾³Ä¿Ç°×îÁ÷ÐеÄÊÇ Tomcat5.0¡£Tomcat5.0 ×Ô¼º°üº¬Ò»¸ö Web ·þÎñÆ÷£¬Èç¹ûÊDzâÊÔ£¬¾Íû±ØÒª°Ñ Tomcat Óë IIS »ò Apache ¼¯³ÉÆðÀ´¡£ÔÚ Tomcat ×Ô´øµÄ Web ·þÎñÆ÷Ï¿ÉÒÔ½øÐÐ Jsp ²âÊÔ¡£
    °²×° Tomcat5.0 Ç°ÐèÒª°²×° JDK(Èç¹ûÊÇ Windows server ......

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

×î»ù±¾µÄÂÒÂëÎÊÌâ
Õâ¸öÂÒÂëÎÊÌâÊÇ×î¼òµ¥µÄÂÒÂëÎÊÌâ¡£Ò»°ãлá³öÏÖ¡£¾ÍÊÇÒ³Ãæ±àÂë²»Ò»Öµ¼ÖµÄÂÒÂë¡£
Html´úÂ룺
£¼%@ page language="java" pageEncoding="UTF-8"%£¾ 
£¼%@ page contentType="text/html;charset=iso8859-1"%£¾ 
£¼html£¾ 
£¼head£¾ 
£¼title ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ