On 10/21/07, Rob Hills <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> I have a weird error on a Listing JSP that's had me stumped for several
> hours.
>
> I have a POJO named "Product" and have built associated ProductDao,
> ProductDaoHibernate, ProductManager, ProductManagerImpl
> and ProductAction classes, as well as tests for Dao, Manager and Action.
> I have a ProductList.jsp and I believe I've correctly configured all the
> "glue" bits (bean defninitions in applicationContext.xml, action
> definitions in struts.xml etc.).
>
> All tests pass OK and the web app starts up (Jetty + HSQLDB).
>
> However, when I go to view my products list, I get a blank page and the
> following error:
>
> [myapp] WARN [btpool0-1] LookupUtil.<init>(99) | Exception: [.LookupUtil]
> Error looking up property "id" in object type
> "java.lang.String". Cause: Unknown property 'id'
> java.lang.NoSuchMethodException: Unknown property 'id'
> at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty
> (PropertyUtilsBean.java:1122)
> at org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(
> PropertyUtils.java:408)
> at org.displaytag.util.LookupUtil.getProperty(LookupUtil.java:271)
> at org.displaytag.util.LookupUtil.getBeanProperty(LookupUtil.java
> :129)
> at org.displaytag.model.Column.getValue(Column.java:124)
> at org.displaytag.model.Column.createChoppedAndLinkedValue(
> Column.java:201)
> at org.displaytag.model.Column.initialize(Column.java:178)
> at org.displaytag.render.TableWriterTemplate.writeTableBody(
> TableWriterTemplate.java:313)
> at org.displaytag.render.TableWriterTemplate.writeTable(
> TableWriterTemplate.java:138)
> at org.displaytag.render.HtmlTableWriter.writeTable(
> HtmlTableWriter.java:643)
> at org.displaytag.tags.TableTag.writeHTMLData(TableTag.java:1557)
> at org.displaytag.tags.TableTag.doEndTag(TableTag.java:1206)
> at
> org.apache.jsp.WEB_002dINF.pages.admin.productList_jsp._jspService(
> org.apache.jsp.WEB_002dINF.pages.admin.productList_jsp:
> 206)
> <.. lots more ..>
>
> Unfortunately, at no point does the stacktrace drop into any of my own
> classes, nor do any of my debug messages appear.
>
> The following snippet is from my ProductList.jsp:
>
> <c:set var="products" value="products" scope="request"/>
I believe this should be <c:set var="products" value="${products}"
scope="request"/>
In your version you are setting the string litral 'products' into the
variable products, hence the error message.....
<display:table name="products" class="table" requestURI="" id="productList"
> export="true" pagesize="25">
> <display:column property="id" sortable="true" href="
> editProduct.html" media="html"
> paramId="id" paramProperty="id" titleKey="product.id"/>
> <display:column property="id" media="csv excel xml pdf" titleKey="
> product.id"/>
> <display:column property="name" sortable="true" titleKey="
> product.name"/>
> <.. lots more ..>
> My initial interpretation of the error message is that the "products" list
> being returned by the c:set line in the jsp is actually coming in as
> a list of strings and the server is complaining that the first String
> doesn't contain an ID (which it wouldn't of course). However, I've been
> back through my classes and the relevant methods are definitely returning
> List<Product>.
>
> The first line of my ProductAction.list() method is a log.debug call that
> never prints to the log so I'm at a loss to figure out what's going
> on.
>
> Has anyone else seen anything like this before? Any thoughts on what
> might be causing this problem, or where I should look?
>
> TIA,
> Rob Hills
> Waikiki, Western Australia
> Mobile +61 (412) 904-357
> Fax: +61 (8) 9529-2137
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>