当前位置:编程学习 > JSP >>

jsp计数器-jsp文件

答案:<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>

上一个:一、Servlet和JSP概述
下一个:邮件发送简单例子-bean文件

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,