Hi,
I'm trying for one day to get a logicsheet to do some work for me. I want to
print out a drop down menu with values from a database and the format
speciefied in my xsp source.
here is the relevant part of the xsp-page (test.xsp)
---------------------------------
<list>
<tiana-sql:listboxitems table="TianaUser">
<tiana-sql:itemelement type="column">Id</tiana-sql:itemelement>
<tiana-sql:itemelement type="text"> - </tiana-sql:itemelement>
<tiana-sql:itemelement
type="column">FirstName</tiana-sql:itemelement>
<tiana-sql:itemelement type="text"> </tiana-sql:itemelement>
<tiana-sql:itemelement
type="column">LastName</tiana-sql:itemelement>
</tiana-sql:listboxitems>
</list>
---------------------------------
and some parts of my tiana-sql logicsheet
---------------------------------
<xsl:template name="get-columns">
<xsl:for-each select="tiana-sql:itemelement[@type='column']">
<xsl:text>, </xsl:text>
<xsp:logic>TianaSQLHelper.getTablePrefix(objectModel, "<xsl:value-of
select="parent::*/@table"/>")</xsp:logic><xsl:value-of select="."/>
</xsl:for-each>
</xsl:template>
<xsl:template match="tiana-sql:listboxitems[@table]">
<xsl:variable name="idcolumn">
<xsp:logic>TianaSQLHelper.getIdColumn(objectModel, "<xsl:value-of
select="@table"/>")</xsp:logic>
</xsl:variable>
<xsl:variable name="in-cond">
<xsl:if test="@in-cond"> WHERE <xsl:value-of select="$idcolumn"/> IN
(<xsl:value-of select="@in-cond"/>)</xsl:if>
</xsl:variable>
<esql:connection>
<esql:pool>tiana</esql:pool>
<esql:execute-query>
<esql:query>
<xsl:text>SELECT </xsl:text>
<xsp:logic>TianaSQLHelper.getIdColumn(objectModel, "<xsl:value-of
select="@table"/>")</xsp:logic>
<xsl:text> AS Id</xsl:text>
<xsl:call-template name="get-columns"/>
<xsl:text> FROM </xsl:text><xsl:value-of select="@table"/>
<xsl:value-of select="$in-cond"/>
</esql:query>
<esql:results>
<esql:row-results>
<item>
<value><esql:get-string column="Id"/></value>
<text>
<xsl:for-each select="tiana-sql:itemelement">
<xsl:choose>
<xsl:when test="@type='text'">
<xsl:value-of select="."/>
</xsl:when>
<xsl:when test="@type='column'">
<!--<esql:get-string>
<esql:column>-->
<xsp:logic>TianaSQLHelper.getTablePrefix(objectModel,
"<xsl:value-of select="parent::*/@table"/>") + "<xsl:value-of
select="."/>"</xsp:logic>
<!--</esql:column>
</esql:get-string>-->
</xsl:when>
</xsl:choose>
</xsl:for-each>
</text>
</item>
</esql:row-results>
</esql:results>
</esql:execute-query>
</esql:connection>
</xsl:template>
---------------------------------
This works fine as long as I comment out the part, where I actually do the
db request (I just get the names of the columns printed out, instead of the
columns). But if I include this request, I get class not found exceptions,
what is not very surprising as an empty test_xsp.java file is generated. But
why is this file empty. When I use <xsp:expr> ... </> instead of logic, I
get an compile error because of a missing ";" in my test_xsp.java.
Can anybody give me a hint how I could get my application working?
By the way, I never really understood when to use xsp:expr and xsp:logic or
both of them. And what is the sense of xsp:component?
Thanks for any help,
Peter
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>