jsp»ù´¡ÖªÊ¶£¨ÕûÀí£©
¸Õ¿ªÊ¼Ñ§jsp£¬×öµÄÒ»µãÌý¿Î±Ê¼Ç¡£
1.jspÈý´óÖ¸Áî
<%@ page ~~~~~~~~ %>
<%@ include file=""%>
<%@ taglib url="" prfix=""%>
2.if(username.equals(""))
out.println("ÐÕÃû²»ÄÜΪ¿Õ£¬Çë<a href=javascript:history.back()>·µ»Ø")£»
&&·ÀÖ¹Ö±½ÓÔÚä¯ÀÀÆ÷ÖÐÊäÈë¼ì²âÒ³Ãæ,²úÉú¿ÕÖ¸Õë´íÎ󣬿ÉÒÔÊäÈë if(username==null|| ursrname.equals(""));
3.ä¯ÀÀÆ÷µÄĬÈϱàÂëÊÇiso8859-1£¬ËùÒÔ¶ÔÓÚÌá½»µÄÖÐÎÄ»á²úÉúÂÒÂë¡£½â¾ö·½°¸£º¶ÔÓÚpost·½·¨Ìá½»µÄÊý¾Ý£¬ÔÚ´¦ÀíÒ³ÃæʹÓÃrequest.setCharacterEncoding("gbk");
¶ÔÓÚpost¡¢get»òurl´«²Î£¬¿ÉʹÓÃString nstr= new String(request.getParameter("nstr").getBytes("iso8850-1"),"gbk");»òÕßÔÚserverÎļþÖнøÐÐÅäÖã¬ÉèÖÃbodyEncodingforurl="true";
4.String[] love=request.getParameterValue("love")//»ñÈ¡¸´Ñ¡¿òÑ¡ÔñµÄ²ÎÊý
´òÓ¡£ºfor(String s:love){ out.println(s +" ");}
5.¿Í»§¶ËÌøת£ºÊÇÖ¸·þÎñÆ÷½«ÇëÇó½á¹û·µ»Ø¸ø¿Í»§¶Ë£¬¿Í»§¶ËÔÙÏò·þÎñÆ÷·¢ÆðÁíÒ»´ÎÇëÇó£¬ÔÚ¿Í»§¶ËÌøת¹ý³ÌÖУ¬¿Í»§¶Ëµ÷תºóµÄurlÊÇ×îºóÒ»´ÎÇëÇóµÄµØÖ·¡£
¿Í»§¶ËÌøת¹»½øÐÐÍøÕ¾ÍâÌøת
¿Í»§¶ËÌøתÓÐÒÔϼ¸ÖÖÐÎʽ£º
*Á´½Ó<a href=“”>
*±íµ¥Ìá½»
*<meta http-equiv="refresh" content="3;url="next.jsp"">
*javascript:history.back();history.forward();//ʹÓô˷½·¨ ÔÀ´ÌîдµÄÐÅÏ¢²»»áÇå³ý
*response.sendRedirect("next.jsp");
*response.setHeader("refresh","3;url=next.jsp")
·þÎñÆ÷¶ËÌøת£¨ÈÝÆ÷ÄÚÌøת£©£ºÄܹ»×Ô¶¯µÄÔÚ·þÎñÆ÷ÄÚ²¿½øÐÐÒ³ÃæµÄת»»£¬ËùÒÔ¶ÔÓÚ¿Í»§¶ËÀ´Ëµ£¬ÕâÖÖÌøתÊÇ͸Ã÷µÄ¡£¶ørequest£¬·þÎñÆ÷ÌøתֻÄÜÊÇÕ¾µãÄÚÌøת
·þÎñÆ÷ÌøתµÄÐÎʽ£º
*<jsp:forward page="">
*pageContent.forward("")
*pagecontent.get
*¿Í»§¶ËÌøתʱµÄ“/”´ú±í·þÎñÆ÷µÄ¸ù
·þÎñÆ÷Ìøת£¨ÈÝÆ÷ÄÚÌøת£©£¬Äܹ»×Ô¶¯µÄÔÚ·þÎñÆ÷ÄÚ²¿½øÐÐÌøת
*·þÎñÆ÷ÌøתʱµÄ"/"´ú±íÕ¾µãµÄ¸ù
6.String path=request.getContextPath();»ñÈ¡Õ¾µãĿ¼Ãû¡£
ÒÔ"/"¿ªÊ¼µÄ·¾¶´ú±í¾ø¶Ô·¾¶£¬ÆäËû´ú±íÏà¶Ô·¾¶
Ïà¶Ô·¾¶Óë¾ø¶Ô·¾¶µÄʹÓÃÊÓÇé¿ö¶ø¶¨
7.¾²Ì¬°üº¬£ºÊ¹ÓÃincludeÖ¸Áî°ÑһЩ¹«¹²µÄÄÚÈÝ°üº¬½øÀ´£¬ÈçÐÂÀ˵ĵ¼º½À¸
*°üº¬µÄÒ³ÃæÖв»ÒªÊ¹Óúͱ
Ïà¹ØÎĵµ£º
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.Servl ......
1.½ûÖ¹¿Í»§¶Ë»º´æÒªÔÚ<head>ÖмÓÈëÀàËÆÈçÏÂÄÚÈÝ£º
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
2.ÔÚ·þÎñÆ÷µÄ¶¯Ì¬ÍøÒ³ÖнûÖ¹»º´æ£¬Òª¼ÓÈëÀàË ......
ÓеÄÒ³ÃæÐèҪÿ´Îµã»÷½øÈ¥¶¼¶¯Ì¬¸üУ¬¶ø²»ÊǶÁÈ¡»º´æÖеÄÒ³Ãæ¡£
ÔÚJSPÖпÉÒÔÕâÑùʵÏÖ£º
<%
request.setCharacterEncoding("GBK");
response.addDateHeader("Expires",0);
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache");
%> ......
ÓõÄÊÇMySqlÊý¾Ý¿â£¬ÀïÃæÓÐÊý¾Ý¿âµÄ½Å²½£¬ÔËÐÐbbs.sqlÎļþ¾Í¿ÉÒÔÁË¡£
ÓõÄMVCģʽ£¬ÓÃjsp ×öÏÔʾҳÃ棬ÓÃservlet×ö¿ØÖƲ㣬ÓÃJavaBean×öÄ£ÐͲã
ÏÂÔصØÖ·£º
http://www.800disk.com/ContentPane.aspx?down=ok&filepath=lcbjava%2fMybbs.rar
°ÑÉÏÃæµÄµØÖ·¸´ÖƵ½ä¯ÀÀÆ÷¾Í¿ÉÒÔÏÂÔØ ......
ÏÖÔÚÖ÷Á÷µÄÍøÕ¾¿ª·¢ÓïÑÔÎÞÍâºõasp¡¢php¡¢asp.net¡¢jspµÈ¡£
ÍøÒ³´Ó¿ªÊ¼¼òµ¥µÄhmtlµ½¸´ÔӵķþÎñÓïÑÔ£¬×ß¹ýÁË10¶à¸öÄêÍ·£¬¸÷ÖÖ¼¼Êõ²ã³ö²»Çµ¥¸öµÄÖ÷Á÷¼¼ÊõÒ²ÔÚ²»¶Ï·Ðµİ汾£¬ÏÖÔÚ·ÖÎöϸ÷ÖÖÓïÑÔµÄÇø±ð¡¢ÓÅÊÆ¡¢ÁÓÊÆ¡¢¿ª·¢×¢ÒâÊÂÏ
HTML:µ±È»ÕâÊÇÍøÒ³×î»ù±¾µÄÓïÑÔ,ÿһ¸ö·þÎñÆ÷ÓïÑÔ¶¼ÐèÒªËüµÄÖ§³Ö,Ҫѧϰ,Õâ¸ö¿Ï¶¨ÊÇ¿ª ......