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" />
Ïà¹ØÎĵµ£º
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
--from MyEclipse, automatically generate. ......
Ò»¡¢´¦ÀíajaxÇëÇóµÄjspÎļþ£ºauto.jsp
<%@ page contentType="text/html; charset=gb2312" %>
<%
//ÉèÖÃÊä³öÐÅÏ¢µÄ¸ñʽ¼°×Ö·û¼¯
response.setContentType("text/xml; charset=UTF-8");
response.setHeader("Cache-Control","no-cache&q ......
¿ÉÄÜ´ó¶àÊýJsp¿ª·¢Ô±ÔÚдÍê³ÌÐò²âÊÔͨ¹ýºó£¬²»Ì«»á¹Ø×¢JspÉú³ÉµÄJavaÎļþ£¬Æäʵ£¬Í¨¹ýJava´úÂ룬¸üÄÜÌåÏÖ³ÌÐò´úÂëµÄÕæÕýº¬Ò壬¶Ô½øÒ»²½Ñо¿³ÌÐò´úÂëµÄºǫ́ÔËÐÐÇé¿öÊǷdz£ÓаïÖúµÄ¡£ÀýÈ磬ÓÃJsp±àд´úÂëʱ£¬ÓÐʱºòÓÃ<%! %>£¬ÓÐʱºòÓÃ<% %>£¬¼Ó²»¼Ó¸Ð̾º ......
JSPÊý¾Ý¿âÁ¬½Ó´óÈ«
2008-07-22 11:47
Ò»¡¢jspÁ¬½ÓOracle8/8i/9iÊý¾Ý¿â£¨ÓÃthinģʽ£©
testoracle.jspÈçÏ£º
< %@ page contentType="text/html;charset=gb2312"% >
< %@ page import="java.sql.*"% >
< html >
< body >
< %Class.forName("oracle.jdbc.driver.OracleDriver").new ......