/*
* ColumnBean.java
*
* Created on 2007年1月8日, 下午10:28
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package ColumnPackage;
/**
*
* @author Administrator
*/
public class ColumnBean {
/** Creates a new instance of ColumnBean */
// public ColumnBean() {
// }
//属性
private String columnID;
//getter方法
public String getColumnID()
{
return this.columnID;
}
//setter方法
public void setColumnID(String c)
{
this.columnID=c;
}
}
/*
* ColumnContentBean.java
*
* Created on 2007年1月8日, 下午10:35
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package ColumnPackage;
/**
*
* @author Administrator
*/
public class ColumnContentBean {
private ColumnBean columnAtrBean;
private String mycolumnID;
/** Creates a new instance of ColumnContentBean */
public ColumnContentBean() {
}
public void setColumnAtrBean(ColumnBean c)
{
this.columnAtrBean=c;
}
public void setMycolumnID(String c)
{
this.mycolumnID=c;
}
public String returnHTML()
{
return "this is a test,ColumnID: " + this.columnAtrBean.getColumnID() ;
}
}
jsp调用:
<%@page contentType="text/html;charset=gb2312" %>
<jsp:useBean id="myColumnBean" class="ColumnPackage.ColumnBean" scope="page">
<jsp:setProperty name="myColumnBean" property="*"/>
</jsp:useBean>
<jsp:useBean id="regist" class="ColumnPackage.ColumnContentBean" scope="page"/>
<html><body>
<%
// String myColumnIDValue = (String)request.getParameter( "columnID" );
//regist.setMycolumnID( myColumnIDValue );
regist.setColumnAtrBean( myColumnBean );
// regist.returnHTML();
out.println( regist.returnHTML() );%>
ewrwrweeeeeeeeeeeeeeeeeeee
</body>
</html>
以上红色代码为一样的调用效果