You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Markus Wiederkehr <ma...@gmail.com> on 2004/10/21 11:53:33 UTC

Re: Help needed on foreach and Vector

The source parameter of Foreach specifies the source of objects to be
iterated. In your case this is only a single object, the ResultSet.
You should use a collection or an array instead. The value parameter
is used to *update* the current value on each iteration. You cannot
invoke next() on the ResultSet here...

See http://jakarta.apache.org/tapestry/doc/ComponentReference/Foreach.html

You should convert the ResultSet into a collection in your getRs()
method and create a page property that holds the value on each
iteration. As Erik said, the collection should be cached in a page
property as well.

Hope that helps,

Markus


On Wed, 20 Oct 2004 23:16:40 -0700 (PDT), damar thapa
<da...@yahoo.com> wrote:
> Hi,
> 
> Thanks, Erik.  Your help is truly appreciated (it is working now.).
> 
> Now, I have one more related side question (this time, I using postgresql to pass the data!).  I have the following html code:
> 
>      <span jwcid="@Foreach" source="ognl:rs" value="ognl:rs.next">
>         <tr>
>              <td><span jwcid="@Insert" value="ognl:rs.getString("serial")"/></td>
>         </tr>
>    </span>
> 
> And, the corresponding java code has the following method:
> 
>     public ResultSet getRs(){
> 
>       ---------------------------
>        ResultSet rs = s.executeQuery(.........);
>       -----------------------------
>        return rs;
>     }
> 
> In this case as well, I get no error, but no data either.  No data, does it mean the method is not getting any data from the Database? Or, I have not structured html code properly?
> 
> Sorry for being a pain.
> 
> Thanks,
> 
> Damar

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


Re: Help needed on foreach and Vector

Posted by damar thapa <da...@yahoo.com>.
Hi,
 
Thanks, Markus and Erik.  I followed the pointers and is working now.
 
Thanks once again.
 
Damar


Markus Wiederkehr <ma...@gmail.com> wrote:
The source parameter of Foreach specifies the source of objects to be
iterated. In your case this is only a single object, the ResultSet.
You should use a collection or an array instead. The value parameter
is used to *update* the current value on each iteration. You cannot
invoke next() on the ResultSet here...

See http://jakarta.apache.org/tapestry/doc/ComponentReference/Foreach.html

You should convert the ResultSet into a collection in your getRs()
method and create a page property that holds the value on each
iteration. As Erik said, the collection should be cached in a page
property as well.

Hope that helps,

Markus


On Wed, 20 Oct 2004 23:16:40 -0700 (PDT), damar thapa
wrote:
> Hi,
> 
> Thanks, Erik. Your help is truly appreciated (it is working now.).
> 
> Now, I have one more related side question (this time, I using postgresql to pass the data!). I have the following html code:
> 
> 
> 
> 
> 
> 
> 
> And, the corresponding java code has the following method:
> 
> public ResultSet getRs(){
> 
> ---------------------------
> ResultSet rs = s.executeQuery(.........);
> -----------------------------
> return rs;
> }
> 
> In this case as well, I get no error, but no data either. No data, does it mean the method is not getting any data from the Database? Or, I have not structured html code properly?
> 
> Sorry for being a pain.
> 
> Thanks,
> 
> Damar

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


		
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!