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

JSPÎÊ´ð¼¯

1¡¢ÈçºÎ»ìºÏʹÓÃJspºÍSSI #include?
ÔÚJSPÖпÉÒÔʹÓÃÈçÏ·½Ê½°üº¬´¿HTML£º
µ«ÊÇÈç¹ûdata.incÖаüº¬JSP CODE £¬ÎÒÃÇ¿ÉÒÔʹÓãº
2¡¢ÈçºÎÖ´ÐÐÒ»¸öḬ̈߳²È«µÄJSP?
Ö»ÐèÔö¼ÓÈçÏÂÖ¸Áî
3¡¢JSPÈçºÎ´¦ÀíHTML FORMÖеÄÊý¾Ý?
ͨ¹ýÄÚÖõÄrequest¶ÔÏó¼´¿É£¬ÈçÏ£º
String item = request.getParameter("item");
int howMany = new Integer(request.getParameter("units")).intValue();
4¡¢ÔÚJSPÈçºÎ°üº¬Ò»¸ö¾²Ì¬Îļþ?
¾²Ì¬°üº¬ÈçÏ£º
¶¯Ì¬°üº¬ÈçÏ£º
5¡¢ÔÚJSPÖÐÈçºÎʹÓÃ×¢ÊÍ?
Ö÷ÒªÓÐËÄÖз½·¨£º
1¡£
2¡£//
3¡£/**Óë**/
4¡£
6¡¢ÔÚJSPÖÐÈçºÎÖ´ÐÐä¯ÀÀÖض¨Ïò?
ʹÓÃÈçÏ·½Ê½¼´¿É£ºresponse.sendRedirect("http://ybwen.home.chinaren.com/index.html");
Ò²ÄÜÎïÀíµØ¸Ä±äHTTP HEADERÊôÐÔ£¬ÈçÏ£º
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
String newLocn="/newpath/index.html";
response.setHeader("Location",newLocn);
7¡¢ÈçºÎ·ÀÖ¹ÔÚJSP»òSERVLETÖеÄÊä³ö²»±»BROWSER±£´æÔÚCACHEÖÐ?
°ÑÈçϽű¾¼ÓÈëµ½JSPÎļþµÄ¿ªÊ¼¼´¿É£º
response.setHeader("Cache-Control","no-store"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
8¡¢ÔÚJSPÖÐÈçºÎÉèÖÃCOOKIE?
COOKIEÊÇ×÷ΪHTTP HEADERµÄÒ»²¿·Ö±»·¢Ë͵ģ¬ÈçÏ·½·¨¼´¿ÉÉèÖãº
Cookie mycookie = new Cookie("aName","aValue");
response.addCookie(mycookie);
9¡¢ÔÚJSPÖÐÈçºÎɾ³ýÒ»¸öCOOKIE?
Cookie killMyCookie = new Cookie("mycookie", null);
killMyCookie.setMaxAge(0);
killMyCookie.setPath("/");
response.addCookie(killMyCookie);
10¡¢ÔÚÒ»¸öJSPµÄÇëÇó´¦ÀíÖÐÈçºÎÍ£Ö¹JSPµÄÖ´ÐÐ
ÈçÏÂÀý£º
if (request.getParameter("wen") != null) {
// do something
} else {
return;
}
11¡¢ÔÚJSPÖÐÈçºÎ¶¨Òå·½·¨
Äã¿ÉÒÔ¶¨Òå·½·¨£¬µ«ÊÇÄã²»ÄÜÖ±½Ó·ÃÎÊJSPµÄÄÚÖöÔÏ󣬶øÊÇͨ¹ý²ÎÊýµÄ·½·¨´«µÝ¡£ÈçÏ£º
public String howBadfrom(HttpServletRequest req) {
HttpSession ses = req.getSession();
...
return req.getRemoteHost();
}
out.print("in general,lao lee is not baddie ");
12¡¢Èç¹ûBROWSERÒѹرÕÁËCOOKIES£¬ÔÚJSPÖÐÎÒÈçºÎ´ò¿ªSESSIONÀ´¸ú×Ù
ʹÓÃURLÖØд¼´¿É£¬ÈçÏ£º
hello1.jsp
Int


Ïà¹ØÎĵµ£º

jspÎļþÏÂÔØÍêÕû·½·¨

µÚÒ»ÖÖ£º
¾ÍÊÇÖ±½Ó¸ø³öÏÂÔصĵØÖ·£¬ÕâÖÖ·½Ê½ºÜ²»ºÃ£¬ÒòΪ»á±©Â¶ÄãµÄµØÖ·£¬´øÀ´ºÜ¶à²»°²È«µÄÒòËØ£¬¿ÉÒÔ˵ÊÇǧÍò²»ÒªÓÃÕâÖÖ
µÚ¶þÖÖ£º
ÏÂÔØÒ³Ãæ
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<html>
<head>
<title>download</title>
</head>
< ......

JSP 9´ó¶ÔÏóÏê½â

ѧϰJSPÖ÷ҪѧϰËûµÄ9´ó¶ÔÏó(request, response, pageContext, session, application, out, config, page, exception ),ÕâЩ¶ÔÏó¶¼ÊǾ²Ì¬¶ÔÏ󣬲»Óö¨Òå¾Í¿ÉÒÔÖ±½ÓʹÓ㬰ÑËûÃǶ¼Á˽âÇå³þ²¢»áÔËÓ㬾ͿÉÒÔÔÚ¼òÀúÉÏÌíÉÏÒ»¸öÊìϤ¼¼ÄÜ:JSP
JspÄÚÖöÔÏó ¹¦ÄÜ Ö÷Òª·½·¨
out  Ïò¿Í»§¶ËÊä³öÊý¾Ý print() println() flush() ......

jspÖÐ×Ô¶¨Òå±êÇ©×ܽá(Ò»)_´«Í³±êǩƪ

×Ô¶¨Òå±êÇ©ÊÇÈÿª·¢ÈËÔ±´´½¨¿Í»§»¯µÄ±êÇ©,²¢ÇÒÔÚjspÎļþÖÐʹÓÃÕâЩ±êÇ©,ÕâÑù¿ÉÒÔʹjsp´úÂë¸ü¼ò½à!
 Ê×ÏÈÕâÀïÏȽéÉÜ´Ó¶¨Òå±êÇ©µ½Ê¹ÓñêÇ©µÄ²½Öè:
     1,´´½¨×Ô¶¨Òå±êÇ©´¦ÀíÀà,¼°Ïà¹ØÀà.class ²¢ÇÒ°ÑËûÃǶ¼·ÅÔÚWEB-INF/classesĿ¼ÏÂ
     2,´´½¨TLD±êÇ©¿âÃèÊöÎļþ(.tld)Î ......

JSPÖеÄCOOKIE²Ù×÷


JSPÖеÄCOOKIE²Ù×÷
Cookie¸ÅÄî:
    CookieµÄ¸ñʽʵ¼ÊÉÏÊÇÒ»¶Î´¿Îı¾ÐÅÏ¢, ÓÉ·þÎñÆ÷Ëæ×ÅÍøÒ³Ò»Æð·¢Ë͵½¿Í»§¶Ë, ²¢±£´æÔÚ¿Í»§¶ËÓ²ÅÌÖÐÖ¸¶¨µÄĿ¼µÄ. ´ó¼Ò¶¼´«ËµCookie»áÔì³ÉÑÏÖصݲȫÍþвʲôµÄ, Æäʵ²»ÊÇÕâô»ØÊÂÇé. ·þÎñÆ÷¶ÁÈ¡CookieµÄʱºò, Ö»Äܹ»¶ÁÈ¡µ½Õâ¸ö·þÎñ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ