主题:关于include的,有点奇怪
Counter.jsp
package com.mycompany.bean;
public class CounterBean{
private int count=0;
public int getCount(){
count++;
return count;
}
public void setCount(int count)
{
this.count=count;
}
}
RequestCounter.jsp
<%@ page contentType="text/html;charset=GBK" %>
<html>
<head>
<title>
CH7-PageCounter
</title>
</head>
<body bgcolor="#ffffff">
<h2>范围为Request的JavaBean示例程序</h2>
<jsp:useBean id="myBean" scope="request" class="com.mycompany.bean.CounterBean" />
<p>您已经访问<font color="red">
<jsp:getProperty name="myBean" property="count" />
</font>次</p>
<p>欢迎再次访问</p>
<jsp:include page="Hello.jsp" flush="true" />
</body>
</html>
Hello.jsp
<%@ page contentType="text/html;charset=GBK" %>
<jsp:useBean id="myBean" scope="request" class="com.mycompany.bean.CounterBean" />
Hello...感谢您第<jsp:getPropetry name="myBean" propetry="count" /></font>次光临!
这是课本上的实例,不知道为什么,运行结果关于“Hello...”后面那一段不能显示,改了好久没办法,请各位帮忙看一下
package com.mycompany.bean;
public class CounterBean{
private int count=0;
public int getCount(){
count++;
return count;
}
public void setCount(int count)
{
this.count=count;
}
}
RequestCounter.jsp
<%@ page contentType="text/html;charset=GBK" %>
<html>
<head>
<title>
CH7-PageCounter
</title>
</head>
<body bgcolor="#ffffff">
<h2>范围为Request的JavaBean示例程序</h2>
<jsp:useBean id="myBean" scope="request" class="com.mycompany.bean.CounterBean" />
<p>您已经访问<font color="red">
<jsp:getProperty name="myBean" property="count" />
</font>次</p>
<p>欢迎再次访问</p>
<jsp:include page="Hello.jsp" flush="true" />
</body>
</html>
Hello.jsp
<%@ page contentType="text/html;charset=GBK" %>
<jsp:useBean id="myBean" scope="request" class="com.mycompany.bean.CounterBean" />
Hello...感谢您第<jsp:getPropetry name="myBean" propetry="count" /></font>次光临!
这是课本上的实例,不知道为什么,运行结果关于“Hello...”后面那一段不能显示,改了好久没办法,请各位帮忙看一下