cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Painter-Wakefield <paint...@mc.duke.edu>
Subject Re: Dynamic parameter for logicsheet
Date Mon, 10 Nov 2003 16:06:52 GMT




My previous answer was lacking in several respects.  Here is a better one:
you are expecting your query to end up with "id = 5", but that won't happen
because your logicsheet is applied *before* the XSP is even turned into
Java code.  So there is no possible way that your logicsheet could obtain
the value "5" from the java variable and do the substitution as you are
expecting.  Here is better code that will behave dynamically, and follows
the "best practices" for ESQL:

<xsl:template match="section:edit">
      ...
            <esql:query>
                  select * from section
                  where id=
                        <esql:parameter type="int">
                              <xsl:copy-of select="section:id/*"/>
                        </esql:parameter>
            </esql:query>
      ...
</xsl:template>

-Christopher



|---------+---------------------------->
|         |           Otmar Vobejda    |
|         |           <otmar@hcwerk.cz>|
|         |                            |
|         |           11/09/2003 08:11 |
|         |           PM               |
|         |           Please respond to|
|         |           users            |
|         |                            |
|---------+---------------------------->
  >--------------------------------------------------------------------------------------------------------------|
  |                                                                                      
                       |
  |       To:       users@cocoon.apache.org                                              
                       |
  |       cc:                                                                            
                       |
  |       Subject:  Dynamic parameter for logicsheet                                     
                       |
  >--------------------------------------------------------------------------------------------------------------|




Hi people, I don't understand one thing:

in XSP file I have this piece of code:

<xsp:logic>
    String sectionId = 5;

    <section:edit>
        <section:id><xsp:expr>sectionId</xsp:expr></section:id>
    </section:edit>

</xsp:logic>

this "calls" template "section:edit" in logicsheet, which is defined:

    <xsl:template match="section:edit">
...
                    <esql:query>select * from section where
id=<xsl:value-of select="section:id"/></esql:query>
...
    </xsl:template>

It should send to SQL server query 'select * from section where id=5',
But to ESQL it sends query 'select * from section where id=sectionId'.

WHY??? And why to do it correctly?

Thanx!

osup


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message