You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by beichuang <be...@yahoo.com> on 2000/10/25 16:30:07 UTC

ESQL & Attributes:

Hello all:

I wonder whether I can construct node attributes for data got from database:

for example:

to construct a node like this:
<link myAttrib1="value1" myAttribute2="value2" >Front Page</link>

here in the line above, the value "value1", "value2" are from database inquiry, and better, "Front Page" also from database, is it possible to make it just with ESQL taglib? if is, then how to deal with the tags:</esql:results>?



Thanks!

Re: ESQL & Attributes:

Posted by Frederic Alluin <fr...@webmedia.es>.
try something like that :
<esql:results>
       <link><xsp:attribute name="myAttrib1"><esql:get-string
column="Col_value1"/></xsp:attribute><xsp:attribute
name="myAttrib2"><esql:get-string
column="Col_value2"/></xsp:attribute><esql:get-string
column="Col_Front_Page"/></link>
      </esql:results>

Regards
Fred

beichuang wrote:

> Hello all: I wonder whether I can construct node attributes for data
> got from database: for example: to construct a node like this:<link
> myAttrib1="value1" myAttribute2="value2" >Front Page</link> here in
> the line above, the value "value1", "value2" are from database
> inquiry, and better, "Front Page" also from database, is it possible
> to make it just with ESQL taglib? if is, then how to deal with the
> tags:</esql:results>?


Re: ESQL & Attributes: (a little bug)

Posted by Donald Ball <ba...@webslingerZ.com>.
On Wed, 25 Oct 2000, beichuang wrote:

> Hello, Kevin and Frederic:
> 
> Thank you all for your help, I made it work now, but I find another little
> bug, that the value can only be used once. for example:

that's JDBC driver dependent. good drivers let you use values more than
once. crappy ones don't. if your database or driver doesn't support column
value reuse, switch databases. :) AFAIK, the only "major" driver that
doesn't support column reuse is the JDBC-ODBC bridge with MS Access, and
if you're using that in production, god help you anyway. switch to mysql
for win32.

i might look into making the esql logicsheet cache resultset values at
some point, but it's not on my to-do list now.

- donald


Re: ESQL & Attributes: (a little bug)

Posted by beichuang <be...@yahoo.com>.
Hello, Kevin and Frederic:

Thank you all for your help, I made it work now, but I find another little
bug, that the value can only be used once. for example:

        <ID>
                 <xsp:attribute name="first_name">
                  <esql:get-string column="First_Name_As_Attribute"/>
                 </xsp:attribute>
                 <esql:get-string column="Fast_Name"/>

         </ID>

         <FN>
                <esql:get-string column="last_name"/>
         </FN>

Here above, the column of database "last_name" are used twice, then only one
record can be retrieve or it stops after get the first record.

So it means if you want a field used as a attribute and at the same time a
node or refer it again, it will fail, I think the way is to save it to a
value the first time visit it, and later just refer to the variable, Am I
right? However, I am not sure how to code as I said above. can you implement
it with xsp codes?

Thanks again.



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: ESQL & Attributes:

Posted by Kevin Sonney <ke...@webslingerz.com>.
On Wed, 25 Oct 2000, beichuang wrote:
> Hello all:
> 
> I wonder whether I can construct node attributes for data got from database:
> 
> for example:
> 
> to construct a node like this:
> <link myAttrib1="value1" myAttribute2="value2" >Front Page</link>
> 
> here in the line above, the value "value1", "value2" are from database inquiry, and better, "Front Page" also from database, is it possible to make it just with ESQL taglib? if is, then how to deal with the tags:</esql:results>?

I use this all the time to build html select list options that looks like
this :

<option value="myValue">Description</option>

What I do is somethink like this :

<esql:results>
<option>
<xsp:attribute name="value"><esql:get-string column="value"/></xsp:attribute>
<esql:get-string column="description"/>
</option>
</esql:results>

-- 
+-------------------------------------------+
| Kevin Sonney        kevin@webslingerZ.com |
| Systems Programmer    www.webslingerZ.com |
+-------------------------------------------+

"The weakest link in any civil rights case is always the
defendant. Imagine being a lawyer and getting a call from me. That's why I
try to, uh, behave myself." - Hunter S. Thompson