在a.jsp中<%@ include file="b.jsp" %>,使b.jsp页面获得javabean属性值。
a.jsp:
...
<jsp:useBean id="products2" class="test2.ContactBean" scope="page"/>
<jsp:setProperty name="products2" property="*" />
...
setUserName("getvalue");
<%@ include file="b.jsp" %>
...
-------------------------------------------------------------------------------
javabean:
...
private String userName;
public void setUserName(String name)
{
this.userName=name;
}
public String getUserName()
{
return this.userName;
}
-------------------------------------------------------------------------------
b.jsp:
<jsp:useBean id="products3" class="test2.ContactBean" scope="page"/>
<jsp:setProperty name="products3" property="*" />
out.println(products3.getUserName())----------------------XXXX
--------------------------------------------------------------------------------
为什么XXXX是null,而不是getvalue???