Re: taglib-datagrid, IllegalArgumentException , org.apache.taglibs.datagrid.DataGridTag.setItems(DataGridTag.java:928)

"Rashmi Rubdi" <[email protected]>
Newsgroups gmane.comp.jakarta.taglibs.user
Message-ID <[email protected]>
On 4/7/07, [email protected] <[email protected]> wrote:
> Before I go and report a bug, I need to ask you a question. I think you
> are about to solve the issue for me.
> I stepped through the source for this tag, and it's not evaluating my
> items as an Collection obj.

If you could patch the bug, you could submit that too in the bug
report. I don't know custom tags yet, otherwise I would have taken a
shot at it.

> I think I am having a problem with the
> syntax I am using. You adviced me to use <jsp:useBean> tag. but what if
> the object I need is an attribute of another object ?

Accessing an Object property of a JavaBean is easy with EL, as long as
the Object property is also a JavaBean.

Here's how:

<jsp:useBean id="someJavaBean" class="your.package.SomeJavaBean"
scope="request"/>

${someJavaBean.anotherJavaBean.propertyOfAnotherJavaBean}

I've tested the above and it works, as long as the main JavaBean and
it's properties are populated and the main JavaBean is stored in
request attribute prior to accessing the JSP

> And I belive that
> 's my problem and what is keeping me away from getting it to work.
> Here, a chunck from my code that I am using to track the issue:
>
> <struts:property value="accountBean.accountNumber" /> <br />
>
> <% AccountBean bean = (AccountBean) request.getAttribute("accountBean") ; %>
> <% ArrayList<InvoiceBean> invoices1 =  bean.getInvoices(); %>
> <% out.print(invoices1); %>

In the above case, I would store the List<InvoiceBean> invoices1 = new
ArrayList<InvoiceBean>(); ----- itself in the Http Request , and then
access the invoices1 in the JSP using

<jsp:useBean id="invoices1" class="java.util.ArrayList" scope="request"/>

But if you want to access it as you've shown above then it might be
possible with some combination of jsp:useBean and c:set etc - I'll try
to see if it's possible.

>
> <c:forEach items="${accountBean.invoices}"  var="inv" >
> <c:out value="${inv.id}" />
> </c:forEach>
> <br />
>
> <ui:dataGrid items="invoices2" var="i" name="datagrid1">
>               <columns>
>                 <column width="100" order="true">
>                   <header value="ID" />
>                   <item   value="${i.id}"/>
>
>                 </column>
>               <columns>
>   </ui:dataGrid >
>
>

-Rashmi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.