hi
for me your code seems ok. as far as i know it should be equal
to have a <property ..> for the loop-var and to have an abstract
getter/setter in your page-class. but i remember that i also
had such problems - can you try to add to your page-class
(and maybe remove the property)
public abstract QuotationProduct getCurrentQuotationProduct();
public abstract void setCurrentQuotationProduct( QuotationProduct qp );
luk
Am Dienstag, 21. Februar 2006 15:10 schrieb Izak Wessels:
> Lukas,
>
> Thank you for your reply, however I am a bit stuck.
>
> in my component class I have :
>
> @Parameter(required = true)
> public abstract Integer getSupplierProductID();
> public abstract void setSupplierProductID(Integer supplierProductID);
>
> and in my loop I have :
>
> <table>
> <tr jwcid="quotationProducts" class="odd">
> SupplierProductID :
> <span class="label-values"
> jwcid="supplierProductID">
> p01
> </span>
>
> Supplier Company Name :
> </span>
> <span class="label-values"
> jwcid="supplierCompanyName">
> p01
> </span>
>
> <span jwcid="@If" condition="ognl:
> agentSession.category.categoryName.equals('Cement')">
> <span
> jwcid="cementSupplierProductSpecificationNonEditable">
> </span>
> </span>
> </tr>
> </table>
>
> In my .page i have
>
> <property name="currentQuotationProduct"/>
> <component id="quotationProducts" type="For">
> <binding name="source" value="quotationProducts"/>
> <binding name="value" value="currentQuotationProduct"/>
> <binding name="element" value="literal:div"/>
> <binding name="class" value="beans.evenOdd.next"/>
> </component>
>
> <component id="supplierProductID" type="Insert">
> <binding name="value" value="
> currentQuotationProduct.supplierProduct.id"/>
> </component>
>
> <component id="cementSupplierProductSpecificationNonEditable"
> type="CementSupplierProductSpecificationNonEditable">
> <binding name="supplierProductID" value="
> currentQuotationProduct.supplierProduct.id"/>
> </component>
>
>
>
> I am getting a NullPointerException saying :
>
> Unable to update OGNL expression '<parsed OGNL expression>' of
> [EMAIL PROTECTED] to 35: source is null for
> getProperty(null, "supplierProduct")
>
> <binding name="supplierProductID" value="
> currentQuotationProduct.supplierProduct.id"/>
>
>
> My guess is that it is because currentQuotationProduct.supplierProduct only
> gets retrieved when the page actually renders
> the For loop, thou my custom component is rendered before that, hence the
> NullPointerException.
>
> Any help would be great,
>
> Thanks
>
> -- Izak
>
> On 2/21/06, Lukas Ruetz <[EMAIL PROTECTED]> wrote:
> > Am Dienstag, 21. Februar 2006 12:30 schrieb Izak Wessels:
> > > Hello all,
> > >
> > > If I have a custom component that gets called if a condition is true
> > > and all of it is inside a for loop, can I pass
> > > a different parameter to the custom component each time i go through
> > > the loop?
> > >
> > > Regards,
> > >
> > > -- Izak
> >
> > hi
> >
> > yes you can. add a parameter to your custom component in the .jwc-file
> > (e.g. an ID)
> >
> > <parameter name="id" required="true" />
> >
> > or in your component-class (with java1.5 annotations)
> >
> > @Parameter(required = true)
> > public abstract int getId();
> > public abstract void setId( int id );
> >
> > and use it in your loop
> >
> > <span jwcid="@For" ..>
> > <span jwcid="MyComponent" id="ognl:currentID" />
> > </span>
> >
> >
> > note: if you try to pass objects to the component, make them
> > serializable.
> >
> > greets
> > lukas
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]