You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by go...@osmosis.gr on 2004/08/01 08:39:11 UTC

Re: [esql] xsp:logic doesn't work inside ?

hi brent 

i use more complex logic in .xsp files succesfull

but in most cases it was very hard to debug. try to take a look at the 
generated .java file from your .xsp in working directory 

in most cases i use to take errors because carier return characters in 
.xsp

a working example:

--snip---
			<esql:execute-query>
				<esql:query>select * from tblElements 
WHERE element_Parent= <xsp:expr>parent_id</xsp:expr> ORDER BY 
element_Title
				</esql:query>
				<esql:results>
					<esql:row-results>
						<element>
							<xsp:logic>
						parent_id = 
<esql:get-string column="id_Elements"/>;						
					</xsp:logic>
							
<esql:get-columns/>
							<!--
					<xsp:expr>parent_id</xsp:expr>		
                                        -->
							<xsp:logic>
					getChilds(parent_id, xspAttr);					
					</xsp:logic>
						</element>
					</esql:row-results>
				</esql:results>
				<esql:no-results>
					<the_end>done</the_end>
				</esql:no-results>
			</esql:execute-query>



--snip---


On Thu, 29 Jul 2004, Brent Johnson wrote:

> I'm not sure if its allowed or not.  But I generally do my Java logic
> prior to the esql tags.  For example.. instead of what you posted I
> usually do something like:
> 
> <page>
>     <xsp:logic>
>         String newvar = null;
>         if (myvar) {
>             newvar = "thisval";
>         } else {
>             newvar = "thatval";
>         }
>     </xslp:logic>
>     ...
>     <esql:query>
>         insert into mytable (myvar) values
> (<esql:parameter><xsp:expr>newvar</xsp:expr></esql:parameter>)
>     </esql:query>
>     ...
> </page>
> 
> Not sure if this answers your question though.
> 
> Hope this helps,
> 
> - Brent
> 
> ----- Original Message -----
> From: Christina <le...@hotmail.com>
> Date: Thu, 29 Jul 2004 16:33:04 -0700
> Subject: [esql] xsp:logic doesn't work inside <esql:query>?
> To: users@cocoon.apache.org
> 
>  
> I tried to use if () inside <esql:query> like this: 
> .... 
> <esql:query> 
>     <xsp:logic> 
>             if (true) { 
>                 <esql:parameter>...</esql:parameter> 
>             } 
>     </xsp:logic> 
> </esql:query> 
> .... 
> but every time there is error message on this "if", it is ok if I
> delete everything before and after the nested <xsp:logic> tag.
> So <xsp:logic> cannot work inside of <esql:query>? or I did something wrong? 
> Thanks!
> 
> ---------------------------------------------------------------------
> 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


Re: [esql] xsp:logic doesn't work inside ?

Posted by Brent Johnson <bl...@gmail.com>.
yes - more complex logic in SQL statements look pretty ugly without
carriage returns and make it hard to read and/or debug.  I just store
my SQL statement in a text file then copy them into the XSP and remove
the carriage returns.

Its definitely not the best way to do it.. but it works.

- Brent

On Sun, 1 Aug 2004 09:39:11 +0300 (EEST), gounis@osmosis.gr
<go...@osmosis.gr> wrote:
> 
> hi brent
> 
> i use more complex logic in .xsp files succesfull
> 
> but in most cases it was very hard to debug. try to take a look at the
> generated .java file from your .xsp in working directory
> 
> in most cases i use to take errors because carier return characters in
> ..xsp
> 
> a working example:
> 
> --snip---
>                         <esql:execute-query>
>                                 <esql:query>select * from tblElements
> WHERE element_Parent= <xsp:expr>parent_id</xsp:expr> ORDER BY
> element_Title
>                                 </esql:query>
>                                 <esql:results>
>                                         <esql:row-results>
>                                                 <element>
>                                                         <xsp:logic>
>                                                 parent_id =
> <esql:get-string column="id_Elements"/>;
>                                         </xsp:logic>
> 
> <esql:get-columns/>
>                                                         <!--
>                                         <xsp:expr>parent_id</xsp:expr>
>                                         -->
>                                                         <xsp:logic>
>                                         getChilds(parent_id, xspAttr);
>                                         </xsp:logic>
>                                                 </element>
>                                         </esql:row-results>
>                                 </esql:results>
>                                 <esql:no-results>
>                                         <the_end>done</the_end>
>                                 </esql:no-results>
>                         </esql:execute-query>
> 
> --snip---
> 
> 
> 
> 
> On Thu, 29 Jul 2004, Brent Johnson wrote:
> 
> > I'm not sure if its allowed or not.  But I generally do my Java logic
> > prior to the esql tags.  For example.. instead of what you posted I
> > usually do something like:
> >
> > <page>
> >     <xsp:logic>
> >         String newvar = null;
> >         if (myvar) {
> >             newvar = "thisval";
> >         } else {
> >             newvar = "thatval";
> >         }
> >     </xslp:logic>
> >     ...
> >     <esql:query>
> >         insert into mytable (myvar) values
> > (<esql:parameter><xsp:expr>newvar</xsp:expr></esql:parameter>)
> >     </esql:query>
> >     ...
> > </page>
> >
> > Not sure if this answers your question though.
> >
> > Hope this helps,
> >
> > - Brent
> >
> > ----- Original Message -----
> > From: Christina <le...@hotmail.com>
> > Date: Thu, 29 Jul 2004 16:33:04 -0700
> > Subject: [esql] xsp:logic doesn't work inside <esql:query>?
> > To: users@cocoon.apache.org
> >
> >
> > I tried to use if () inside <esql:query> like this:
> > ....
> > <esql:query>
> >     <xsp:logic>
> >             if (true) {
> >                 <esql:parameter>...</esql:parameter>
> >             }
> >     </xsp:logic>
> > </esql:query>
> > ....
> > but every time there is error message on this "if", it is ok if I
> > delete everything before and after the nested <xsp:logic> tag.
> > So <xsp:logic> cannot work inside of <esql:query>? or I did something wrong?
> > Thanks!
> > 
> > ---------------------------------------------------------------------
> > 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
> 
>

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