tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rashmi Rubdi" <rashmi....@gmail.com>
Subject Re: taglib-datagrid, IllegalArgumentException , org.apache.taglibs.datagrid.DataGridTag.setItems(DataGridTag.java:928)
Date Sun, 08 Apr 2007 00:46:55 GMT
On 4/7/07, mansour77@yahoo.com <mansour77@yahoo.com> 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

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message