首页 > 编程 > JSP > 正文

jsp计数器-jsp文件

2020-07-27 21:55:01
字体:
来源:转载
供稿:网友
<HTML>
<HEAD>
<TITLE>JSP Bean Example</TITLE>
</HEAD>

<BODY>

<!-- Set the scripting language to java -->
<%@ page language="java" %>

<!-- Instantiate the Counter bean with an id of "counter" -->
<jsp:useBean id="counter" scope="session" class="Counter" />

<!-- Set the bean's count property to the value of -->
<!-- the request parameter "count", using the -->
<!-- jsp:setProperty action. -->
<jsp:setProperty name="counter" property="count" param="count" />

<%

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

%>

<!-- Get the bean's count property, -->
<!-- using the jsp:getProperty action. -->
Count from jsp:getProperty :
<jsp:getProperty name="counter" property="count" /><BR>

</BODY>
</HTML>
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表