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

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Ö¸Áî°ÑһЩ¹«¹²µÄÄÚÈÝ°üº¬½øÀ´£¬ÈçÐÂÀ˵ĵ¼º½À¸
 *°üº¬µÄÒ³ÃæÖв»ÒªÊ¹Óúͱ


Ïà¹ØÎĵµ£º

jspÉú³ÉÑéÖ¤Âë

ÑéÖ¤ÂëµÄÉú³É˼ÏëÊÇÔÚ·þÎñÆ÷¶ÎÔ¤ÏÈÉú³ÉºÃÑéÖ¤Â룬ǰ̨ÏÔʾ£¬È»ºóÔÙµ½ºǫ́ȥƥÅ䣡
code.jsp:
<%@ page language="java" import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*"
contentType="image/jpeg" pageEncoding="UTF-8"%>
<% //ÉèÖÃÒ³Ãæ²»» ......

jspµ÷ÓÃjavabeanʵÀý

goodsbean.java
package sale;
public class goodsbean{
    String Product;
    double Price;
    public goodsbean (){
    this.Product = "box";
    this.Price = 5.0;
    }
public void setProduct (String ......

jspÉÏ´«Í·ÏñÒÔ¼°Éú³ÉËõÂÔͼ


<%@ page autoFlush="false" contentType="text/html;charset=utf-8" language="java" import="java.io.*,java.awt.Image,java.awt.image.*,com.sun.image.codec.jpeg.*,java.sql.*,com.jspsmart.upload.*,java.util.*,java.io.FileInputStream,java.io.FileOutputStream,java.awt.*"%>
<%@ page import="com.b ......

JSPÒ³ÃæÇ¿ÖƲ»»º´æµÄ·½·¨

ÓеÄÒ³ÃæÐèҪÿ´Îµã»÷½øÈ¥¶¼¶¯Ì¬¸üУ¬¶ø²»ÊǶÁÈ¡»º´æÖеÄÒ³Ãæ¡£
ÔÚJSPÖпÉÒÔÕâÑùʵÏÖ£º
<%
request.setCharacterEncoding("GBK");
response.addDateHeader("Expires",0);
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache");

%> ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ