Ok, I see your point, I must do it myself -- I was hoping there was a
"bultin" way to do it. To me, it looks like a pretty basic
functionality: for instance, generating an RDF/XML containing a list of
rows:
* first, generating all existing entities(rows) (=> one iteration)
* then adding the sequence (another iteration needed)
I don't see how that could be done in one iteration only.
Thank you very much for taking the time to answer :)
Adrian.
On Wed, 2004-02-18 at 18:39, [EMAIL PROTECTED] wrote:
> You could try it as follows :
>
> define two classes at bottom of <xsp:page>:
>
> <xsp:logic>
>
> public class MyPart {
> private String id;
> private String name;
>
> public MyPart(String id) {
> this.id = id;
> }
>
> public String getId() {
> return this.id;
> }
>
> public void setName(String name) {
> this.name = name;
> }
>
> public String getName() {
> return this.name;
> }
> }
>
> public class MyReusableResultset {
> private LinkedList myresults;
>
> public MyReusableResultset() {
> this.myresults = new LinkedList();
> }
>
> public void addMyPart(MyPart mypart) {
> this.myresults.add(mypart);
> }
>
> public Iterator getMyResultsIterator() {
> return this.myresults.iterator();
> }
>
> }
>
> </xsp:logic>
>
> Then
>
> use following code ::
>
> <xsp:logic>
> MyReusableResultset myrs = new MyReusableResultset();
> </xsp:logic>
> <esql:connection>
> <esql:driver>??</esql:driver>
> <esql:dburl>??</esql:dburl>
> <esql:username>??</esql:username>
> <esql:password>??</esql:password>
> <esql:execute-query>
> <esql:query>SELECT part_id, part_nom FROM partenaire</esql:query>
> <esql:use-limit-clause>auto</esql:use-limit-clause>
> <esql:max-rows>50</esql:max-rows>
> <esql:skip-rows>20</esql:skip-rows>
> <esql:results>
> <esql:row-results>
> <xsp:logic>
> MyPart newpart = new MyPart(<esql:get-string
> column="part_id"/>);
> newpart.setName(<esql:get-string column="part_nom"/>);
> myrs.addMyPart(newpart);
> </xsp:logic>
> </esql:row-results>
> </esql:results>
> <esql:no-results>
> <Message>Sorry, no results!</Message>
> </esql:no-results>
> </esql:execute-query>
> </esql:connection>
>
> Now you can reuse it elsewhere :
>
> like for instance to create table :
> <form:table>
> <form:row header="true">
> <form:column>PartNo</form:column>
> <form:column>Name</form:column>
> </form:row>
> <xsp:logic>
> for (Iterator i = myrs.getMyResultsIterator(); i.hasNext();) {
> <form:row>
> <form:column>
> <xsp:expr>((MyPart)i.next()).getId()</xsp:expr>
> </form:column>
> <form:column>
> <xsp:expr>((MyPart)i.next()).getName()</xsp:expr>
> </form:column>
> </form:row>
> }
> </xsp:logic>
> </form:table>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]