jsp计数器-jsp文件

1<html>
2<head>
3<title>JSP Bean Example</title>
4</head>
5<body>
6<!-- Set the scripting language to java -->   

@ page language="java"

1  
2<!-- Instantiate the Counter bean with an id of "counter" -->
3<jsp:usebean class="Counter" id="counter" scope="session"></jsp:usebean>
4<!-- Set the bean's count property to the value of -->
5<!-- the request parameter "count", using the -->
6<!-- jsp:setProperty action. -->
7<jsp:setproperty name="counter" param="count" property="count"></jsp:setproperty>   
8  

// write the current value of the property count
out.println("Count from scriptlet code : "
+ counter.getCount() + "<br/>");

1  
2<!-- Get the bean's count property, -->
3<!-- using the jsp:getProperty action. -->   
4Count from jsp:getProperty :   
5<jsp:getproperty name="counter" property="count"></jsp:getproperty><br/>
6</body>
7</html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus