You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jason Cox <ja...@myway.com> on 2003/11/07 02:11:39 UTC
Re: Foreach Table problem (SOLVED?)
I thought I was doing it right.
The answer, as usual, was something simple. In my 'lib' directory, I still had two old JAR files. I have seen Tomcat get confused in this way before. Apparently I need to alter my Ant file to remove or move old JAR's.
I am now getting a different error, but it is specific to the database I am accessing. The DB didn't like the connection string I passed it. C'est la vie.
--- On Thu 11/06, Jason Cox < jasono_tapestry@myway.com > wrote:
From: Jason Cox [mailto: jasono_tapestry@myway.com]
To: tapestry-user@jakarta.apache.org
Date: Thu, 6 Nov 2003 16:24:14 -0500 (EST)
Subject: Re: Foreach Table problem
<br>Well, looks like I'm having the same problem. Oddly enough, I seem to be doing everything that was suggested.<br><br>HomePage.java<br>public class HomePage extends BasePage {<br> <br> private ArrayList newsItems;<br> private NewsData news;<br> private String errorMsg;<br> <br> public ArrayList getNewsItems() {<br> System.out.println("Setting ArrayList");<br> try {<br> newsItems = FetchNewsDAO.getNews();<br> } catch (SQLException sqle) {<br> errorMsg = sqle.getMessage();<br> }<br> return newsItems;<br> }<br> public NewsData getNews() {<br> return news;<br> }<br> public void setNews (NewsData newsItem) {<br> news = newsItem;<br> }<br> protected void initialize() {<br> newsItems = null;<br> news = null;<br> }<br>}<br><br>home.html<br><span jwcid="@Border"><br><table border="0" cellpadding="3"><br> <tr jwcid="@Foreach" source="ognl:newsItems" value="ognl:news" element="tr"><br> <th valign="middle"><img jwcid="@Image" image="ognl:news.image"/></th><br> <td valign="top"><br> <b><font color="#0066ff"><span jwcid="@Insert" value="ognl:news.headline"/></font></b><br> <br/><br> <span jwcid="@Insert" value="ognl:news.info"/><br> </td><br> <td valign="top" align="right"><br> <i><span jwcid="@Insert" value="ognl:news.posted"/></i><br> </td><br> </tr><br></table><br><br></span><br><br>home.page<br><?xml version="1.0" encoding="UTF-8"?><br><!DOCTYPE page-specification PUBLIC<br> "-//Apache Software Foundation//Tapestry Specification 3.0//EN"<br> "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"><br><br><page-specification class="net.citigroup.bi.pages.HomePage"><br> <br> <context-asset name="$template" path="home.html"/><br><br></page-specification><br><br>I wish I could get Spindle 3, but my corporate proxy will not let anything except a web browser have access out. I cannot get the Eclipse update to work at all. Is there anyway to get Spindle 3 from a regular download?<br> --- On Thu 11/06, Kevin C. Dorff < kdorff@kcp.com > wrote:<br>From: Kevin C. Dorff [mailto: kdorff@kcp.com]<br>To: tapestry-user@jakarta.apache.org<br>Date: Thu, 06 Nov 2003 08:32:07 -0700<br>Subject: Re: Foreach Table problem<br><br>Assuming this template is from Home.html, do you have a Home.page which <br>points to a class Home.java. And in the class Home.java do you have a <br>method of a signature such as<br><br> public Collection getCustomerList() {<br> return(somecollection);<br> }<br><br>Noting that where I said "Collection" it can be any class that <br>implements the interface "Collection" (such as an ArrayList).<br><br>Are you using Eclipse and Spindle? Spindle points out MANY simple <br>Tapestry problems and is really worth using. If you are not using both <br>Eclipse 2.1.1 and Spindle 3.0.17 you should really consider going that <br>route.<br><br>Is Home.html either in /context or in /context/WEB-INF ?<br>Is Home.page in /context/WEB-INF ?<br>Is Home.java being compiled and placed in /context/WEB-INF/classes ?<br><br>If you are getting that it cannot resolve the expression 'customerList' <br>that suggets to me that you don't have that method in the class you have <br>associated with t<br> he page.<br><br>Kevin<br><br>Vijay Tekumalla wrote:<br><br>>Dear Kevin,<br>><br>>That is very help full.I could make out the effort you have taken.Great.<br>><br>>But I used <br>> <tr jwcid="@Foreach" source="ognl:customerList" value="ognl:customer"<br>>element="tr"><br>> <td><span jwcid="@Insert" value="ognl:customer.id"/></td><br>> <td> </td><br>> <td><span jwcid="@Insert" value="ognl:customer.fullName"/></td><br>> <td> </td><br>> <td><span jwcid="@Insert" value="ognl:customer.memberLevel"/></td><br>> </tr><br>><br>>in my code and the follwoing error comes up<br>>Unable to resolve expression 'customerList' for Home@2c5444[Home].<br>><br>>Please for the last time.Help me out.<br>>Thanks.<br>>Vijay<br>><br>>-----Original Message-----<br>>From: Kevin C. Dorff [mailto:kdorff@kcp.com]<br>>Sent: Thursday, November 06, 2003 8:24 PM<br>>To: Tapestry users<br>>Subject: Re: Foreach Table problem<br>><br>><b
r>>You are correct, you do not need entries for any of the compon<br> ents in <br>>your .page file, but, your .page file needs to specify a class, such as<br>><br>>[hello.page]<br>><page-specification class="hello"><br>></page-specification><br>><br>>Now assuming you have an object called Customer, with a file called <br>>Customer.java<br>><br>>[hello.java]<br>>public class hello extends BasePage {<br>><br>> //...<br>><br>> //Return the list for the @Foreach. I use<br>> //ArrayList's but any Collection will work<br>> ArrayList alResults = null;<br>> public ArrayList getCustomerList() {<br>> alResults = /*Some method to build your list of Customers*/;<br>> return(alResults);<br>> }<br>><br>> //This is what @Foreach will use for iteration<br>> private Customer oCustomer = null;<br>> public Customer getCustomer() {<br>> return(oCustomer);<br>> }<br>> public void setCustomer(Customer newval) {<br>> oCustomer=newval;<br>> }<br>><br>> protected void initialize() {<br>> //Return all of your clas<br> ses member variables<br>> //to a pristine state in an initialize or detach method.<br>> //initialize is what Tapestry documentation recommends.<br>> alResults = null;<br>> oCustomer = null;<br>> }<br>><br>>}<br>><br>>[Customer.java]<br>>public class User implements Serializable {<br>> private int iId=-1;<br>> private String sFullName<br>> private int iMemberLevel=1;<br>><br>> public int getId() { return(iId); }<br>> public void setId(int newval) { iId = newval; }<br>><br>> public String getFullName() { return(sFullName); }<br>> public void setFullName(String newval) { sFullName = newval; }<br>><br>> public int getMemberLevel() { return(iMemberLevel); }<br>> public void setMemberLevel(int newval) { iMemberLevel = newval; }<br>>}<br>><br>>--Kevin<br>><br>>Vijay Tekumalla wrote:<br>><br>> >Hi ,<br>> ><br>> > If I use the below code in my HTML don't I have to make an entry <br>>in the<br>> >.page file.Please help me.If I have to mak<br> e an entry how do i do it.I<br>> >appreciate your help.<br>> ><table cellspacing="6"><br>> > <tr><br>> > <td>ID</td><br>> > <td> </td><br> <br>> > <td>Name</td><br>> > <td> </td><br>> > <td>Level</td><br>> > </tr><br>> > <tr><br>> > <td colspan="5"><hr></td><br>> > </tr><br>> > <tr jwcid="@Foreach" source="ognl:customerList" value="ognl:customer"<br>> >element="tr"><br>> > <td><span jwcid="@Insert" value="ognl:customer.id"/></td><br>> > <td> </td><br>> > <td><span jwcid="@Insert" value="ognl:customer.fullName"/></td><br>> > <td> </td><br>> > <td><span jwcid="@Insert" value="ognl:customer.memberLevel"/></td><br>> > </tr><br>> ></table><br>> ><br>><br>><br>><br>><br>>---------------------------------------------------------------------<br>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org<br>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org<br>><br>>---------------------------------------------------------------------<br>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org<br>>For additional commands, e-mail: tapestry-user-help@jakar<br> ta.apache.org<br>><br>><br>> <br>><br><br><br><br><br>---------------------------------------------------------------------<br>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org<br>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org<br><br><br><br>_______________________________________________<br>No banners. No pop-ups. No kidding.<br>Introducing My Way - http://www.myway.com<br><br>---------------------------------------------------------------------<br>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org<br>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org<br><br>
_______________________________________________
No banners. No pop-ups. No kidding.
Introducing My Way - http://www.myway.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org