You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sri Sankaran <Sr...@sas.com> on 2003/02/07 17:02:44 UTC
[NESTED] Looking for getter in the wrong bean
Using Struts 1.1b3
A page fails to load with an exception that says that the necessary getter is not available in a bean. The trouble is that the framework is looking at the wrong bean.
A little more background: The problem code looks like this:
<nested:form action="products.do">
<nested:iterate
property="prodsNotInstalled"
type="com.sas.mis.qs.struts.bean.ProductBean"
id="currentProduct">
<nested:multibox
property="../selectedItems">
<nested:write property="software_code"/>
</nested:multibox>
</nested:iterate>
</nested:form>
This results in the error
No getter method for property prodsNotInstalled[0].software_code
of bean sitebean'
Now, the action mapping for the action 'products.do' is
<action path="/products"
name="products"
validate="true"
type="com.sas.mis.qs.struts.action.ProductsAction"
scope="session"
input="Products">
<forward name="next"
path="Quantities"/>
</action>
So, the above <nested:form> should be working with a form-bean called 'products'. Why is it looking for a bean called 'sitebean'?
My own sleuthing has revealed that the culprit is a segment of code preceding the <nested:form> that I've shown above. It looks like
<nested:root name="sitebean">
<%-- stuff happens here --%>
</nested:root>
Why should this matter? I'm closing out the <nested:root>. I found that commenting out this section results in the <nested:form> working correctly.
As an aside : This code works verbatim in Struts 1.0.2
Any thoughts?
Sri