我正在研究具有一些旧 jsp 文件的旧系统。
testParent类有一组testChild类。testParent有一个返回单个testChild对象的方法,而testChild对象有numberIWant. 方法在testParent
public TestChild giveTestChild()
{
TestChild testChild= this.testChilderen.iterator().next();
return testChild;
}
和testChild.getNumberIWant
这就是我尝试在jsp中实现的方式
<jsp:useBean id="parentClass" class="package.TestParent" scope="request"/>
<jsp:useBean id="childClass" class="package.TestChild" scope="request"/>
<input:text name="numberIWant" bean="parentClass.giveTestChild()"
attributesText="id='numberIwant' " size="20"/>
但它不起作用。由于 Hibernate,我testParent始终可以使用并且不想单独调用testChild