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 ProductName){
this.Product = ProductName;
}
public String getProduct(){
return (this.Product);
}
public void setPrice (double priceValue){
this.Price = priceValue;
}
public double getPrice(){
return (this.Price);
}
}
±àÒëÍêÉú³ÉµÄ.classÎļþ£¬·Åµ½£ºTomcat 5.5\webapps\ROOT\WEB-INF\classes\sale Ŀ¼Ï¡£
µ÷Ó÷½·¨£º
<%@ page contentType="text/html;charset=GB2312"%>
<%//request.setCharacterEncoding("iso_8859_1");%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>goodsbean</title>
</head>
<body>
<jsp:useBean id="goodsbean" scope="application" class="sale.goodsbean" />
<%
goodsbean.setProduct("clock");
goodsbean.setPrice(17);
%>
ʹÓ÷½·¨1£º
²úÆ·£º<%= goodsbean.getProduct()%><br>
Ë°ÂÊ£º<%= goodsbean.getPrice()%>
<%goodsbean.setProduct("chair");
goodsbean.setPrice(3);
%>
<br>ʹÓ÷½·¨2£º
²úÆ·£º<jsp:getProperty name="goodsbean" property = "Product" />
<br>
Ë°ÂÊ£º<jsp:getProperty name="goodsbean" property = "Price" />
</body>
</html>
×¢Ò⣺ÉèÖÃbeanµÄÊôÐÔÈçÏÂ
<jsp:setProperty name="goodsbean" property = "Product" value="asdf"/>
<jsp:setProperty name="goodsbean" property = "Price" value="adad" />
Ïà¹ØÎĵµ£º
À´Ô´ÓÚ¡¶Java¡¢javaEEÈí¼þ¹¤³Ìʦ¾ÍÒµÇóÖ°Êֲᡷ
1 HttpServletRequestÀàµÄrequest¶ÔÏ󣺴ú±íÇëÇó¶ÔÏó£¬Ö÷ÒªÓÃÓÚ½ÓÊÜ¿Í»§¶Ëͨ¹ýHTTPÐÒéÁ¬½Ó´«Êäµ½·þÎñÆ÷µÄÊý¾Ý¡£
2 HttpServletResponseÀàµÄresponse£º´ú±íÏìÓ¦¶ÔÏó£¬Ö÷ÒªÓÃÓÚÏò¿Í»§¶Ë·¢ËÍÊý¾Ý¡£
3 JspWriterÀàµÄout¶ÔÏó:Ö÷ÒªÓÃÓÚÏò¿Í»§¶ËÊä³öÊý¾Ý£¬OutµÄ»ùÀàÊÇJspWriter¡ ......
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.ÔÚ·þÎñÆ÷µÄ¶¯Ì¬ÍøÒ³ÖнûÖ¹»º´æ£¬Òª¼ÓÈëÀàË ......
´ÓÍøÉϲéÕÒ×ÊÁÏjava/jsp»ñµÃ¿Í»§¶Ë(IE)Íø¿¨MACµØÖ·µÄ·½·¨´ó¸ÅÓÐÈýÖÖ¡£
1¡¢Í¨¹ýÃüÁʽ£¬ÔÚ¿Í»§¶ËÖ´ÐÐIpconfig µÈµÈ
2¡¢Í¨¹ýActiveXµÄ·½·¨
3¡¢Í¨¹ýÏò137µÄ¶Ë¿Ú·¢ËͲéѯָÁîµÄ·½·¨
¼ò½é£º
µÚÒ»ÖÖ·½·¨,ÔÚÕæÕýÓõ½Ê±ºò²»ÖªµÀΪʲô»ñµÃmacµØÖ·µÄÖ¸Áî×èÈûÁË,²»ÍùϼÌÐøÖ´ÐС£¶øÇÒËÙ¶ÈÊÇÕâÈýÖÖ·½·¨ÖÐ×îÂýµÄÒ»ÖÖ¡£
´úÂëÈçÏ ......