Hi Dusty,

Thanks for the reply

On 21 Oct 2007 at 16:20, dusty wrote:

> The secret to this problem is in the exception message "Error looking up
> property .... in object type "java.lang.String"
> 
> Since you are using struts use the <s:set /> tag to set the products List
> OGNL variable to a JSTL variable.

OK, this exposes the shallowness of my understanding of the underlying 
technologies.  You've rightly pointed out I was using the JSTL c:set tag 
instead of the struts s:set tag.  This occurred because I misread that part of 
the tutorial.  I've only got a very superficial understanding of OGNL and 
specifically how it is used in AppFuse.  I've since done a bit of googling 
around, looking at Struts/JSTL documentation and some of the AppFuse 
source but I still don't understand:

1.      In the context of AppFuse what is the practical difference between 
c:set and s:set?  In what kinds of scenarios would you use c:set instead of 
s:set and vice versa?

2.      What things does AppFuse pre-load into OGNL (and/or other 
transient stores) prior to evaluating a JSP page and where does it do that?  
This might help me to understand why a POJO that uses the Generic DAO 
and Manager structures doesn't need a "<s:set " tag in their "pojoList.jsp" to 
expose the "getPojos" method.

Maybe there are pages on appfuse.org that explain all this stuff, if so I'm 
sorry - please point me at them and I'll shut up for a while :-)

>  Also it the class of the objects in your list is String and not the Product 
> class you think you have.  Please post
> your DAO, Manager and Action code so we can see why you have Strings instead 
> of Products. 

Yes, that was how I also interpreted the error message.  I've been back 
through the DAO, Manager and Action code specifically looking for the 
possibility that somewhere a list of Strings was being returned, but each of 
the relevant methods is definitly returning a List<Product>.  I'm happy to post 
the code if it ends up being necessary, but I'm a bit reluctant to have other 
people wade through that stuff unnecessarily.

> Rob Hills 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"/>
> > <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?

Thanks for all the help so far,
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]

Reply via email to