If you are interested in executing SQL from your JSPs, the taglibs project
might save you some time.

Check into:
http://jakarta.apache.org/taglibs/doc/dbtags-doc/intro.html


For what its worth, this approach breaks the model-view separation struts
may have provided for your project. If that's ok for your project, then the
afore-mentioned taglibs should save you time. On the other hand, if your not
sure what model-view separation is, I would recommend reviewing the Struts
User's Guide - Introduction at:
http://jakarta.apache.org/struts/userGuide/introduction.html


Regards,
Levi Cook


-----Original Message-----
From: Mindaugas Idzelis [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 07, 2001 9:06 AM
To: [EMAIL PROTECTED]; Jonathan Asbell
Subject: RE: Suggestion/Idea for <iterate> tag: Iterate ResultSets


I just thought of another option: If resultsets are tied to a connection and
a statement, then specify the sql query within the iterator:

Hypothetical taglibs:
<sql:query id="myQuery">
                SELECT col1, col2
                FROM table
                WHERE id > 1
                <!-- even use <bean:write> in here to dynamically make
queries -->
</sql:query>
<logic:iterate id="row" query="myQuery">
        <bean:write name="row" property="col1"/>
        <bean:write name="row" property="col2"/>
        <br>
</logic:iterate>

Where sql:query would only be evauluated once per iteration. Would this be
possible to create? I have never authored a taglib, so any feedback from
taglib veterans is greatly appreciated. I think this would be a great
addition to the taglibs framework.

--min

-----Original Message-----
From: Jonathan Asbell [mailto:[EMAIL PROTECTED]]
Sent: Sunday, May 06, 2001 11:47 PM
To: [EMAIL PROTECTED]
Subject: Re: Suggestion/Idea for <iterate> tag: Iterate ResultSets


Result sets ARE tied to the connection in a way.  Some DB drivers throw
exceptions when you try to manipulate data while you still have a pointer to
rows.  At work we were trying to manipulate a stream which was pointing to
an output parameter in a stored proc while the connection was open.  The
result was that we had to convert the stream into another object (String in
our case) and close the connection just to manipulate the data.

----- Original Message -----
From: "Mindaugas Idzelis" <[EMAIL PROTECTED]>
To: "struts" <[EMAIL PROTECTED]>
Sent: Sunday, May 06, 2001 9:33 PM
Subject: Suggestion/Idea for <iterate> tag: Iterate ResultSets


> I just thought up of an excellent idea (although, I wasn't the only one).
> Use the iterate tag to iterate over the rows of a resultset. The column
meta
> data could be exposed as beans named as the column name. A <bean:write>
> operation would display the data in the column.
>
> I did a search about this topic in the mailing list archive, and I found
> this message:
>
> http://marc.theaimsgroup.com/?l=struts-user&m=98269295229785&w=2
>
> It talk about ResultSets being tied to connections. This is not the case.
> ResultSets are tied to the statements that produced them, and as far as I
> can tell, statements are not closed when the connection is closed.
>
> Other than that, It should be easy to change the iterate tag to support
> resultsets. If anyone is interested in helping me extend or develop a tag
> for this purpose, please message me.
>
> --min
>

Reply via email to