You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Georg Spar <in...@sparg.de> on 2002/08/16 18:03:16 UTC

problem with dynamic parameters in XSP + ESQL

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi @ll,

I 've got a problem with dynamic parameters in an XSP-ESQL-Combined
Page.
What I want to do:
I just want to write a dynamically generated XSP-Page which put out
the results of an ESQL-Query in a html-table. Each row of the table
should have one <td>-tag with a link to another XSP-Page, where the
user can view the whole entry of the database, and a few other
<td>-tags only to inform the user.

In a scripting language like PHP this could be done very simple, the
link look like that:
http://show.xsp?mid=<? $mid ?> where $mid is the specific ID of the
entry in the database-table 

How is this be done in Cocoon? 

I tried several ways, first I simply tried to put the string in the
href-parameter of <xsp-session:encode-url>, but in a tag you can't
use a '<'-Sign, so the esql-variable can't be put in.

Then I tried some substitutions with XSL-Templates, doesn't work to.

Then I  want to use actions, but the result-page does not contain any
parameters.

So I'm very confused now. Can somebody help me, please?

Thanks for every idea
Georg

PS: @Christian Haul: I've solved the last problem on my own. There
was no problem with ESQL and nested queries, the only problem was
that Cocoon starts counting esql-fields with "1" and not with "0" ;-)

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPV0iQaID3cBIHLXcEQIB+QCeLoaKg8jMRzgezkRWLgykcYvso8wAoM8V
ytbo8R5hgXc0n+NvDH7Wfdkt
=KIpf
-----END PGP SIGNATURE-----


Re: problem with dynamic parameters in XSP + ESQL

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 17.Aug.2002 -- 03:49 AM, Georg Spar wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> very funny!
> this is what I tried out:
> 
> <!-- -----snip ------->
> <xsp:logic>
>         String ref = <esql:get-string column="mail_ID"/>;
>         String m_from = <esql:get-string column="mail_from"/>;
> </xsp:logic>
> 
> <!-- -----snip ------->
> <xsp-session:encode-url>
>     <xsp:attribute
> name="href">http://linuxsrv:8080/cocoon/wedamas/show.xsp?mid=<xsp:expr
> >ref</xsp:expr></xsp:attribute>
>         <esql:get-string column="mail_ID"/>       
> </xsp-session:encode-url>

Attention! Do you *know* what xsp-session:encode-url does?
Do you *know* what the difference between logicsheet tags
and content tags is?

xsp:attribute has no effect here since it adds an attributes
event to the output pipeline (this is not correct 100% but
it captures the idea), You want to specify an attribute to a
logicsheet tag. For this, the *logicsheet* needs to support that
_and_ provide a tag for doing it.

Most logicsheets use <XXXX:param name="name">value</XXXX:param> where
XXXX is the xmlns prefix they use. E.g. <xsp-request:param/>.
Others use different conventions, do not provide it at all or only
for some attributes.

Second, xsp-session:encode-url encodes the user's session id in
a url, This may be your intention here, but complicates the issue
further.

Third, why is the esql tag outside the xsp:attribute?

In case you care, xsp-session:encode-url does work only on real
attributes (i.e. does not allow to dynamically specify them), and
copies the tag's children right after the opening tag.

So, the behaviour observed is the behaviour to expect.

If you would replace the <xsp-session:encode-url/> with a non-
logicsheet tag, i.e. <a>, it would work.

This is covered in depth in the xsp documentation. Please re-read
and help to rephrase it / extend it if you feel it is not sufficiant.

	Chris.

Please follow up summarizing your problem and which suggested solution
/ information worked for you when you consider your problem
solved. Add "SUMMARY: " to the subject line. This will make FAQ
generation and searching the list easier. In addition, it makes
helping you more fun. Thank you.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: problem with dynamic parameters in XSP + ESQL

Posted by Georg Spar <in...@sparg.de>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

very funny!
this is what I tried out:

<!-- -----snip ------->
<xsp:logic>
        String ref = <esql:get-string column="mail_ID"/>;
        String m_from = <esql:get-string column="mail_from"/>;
</xsp:logic>

<!-- -----snip ------->
<xsp-session:encode-url>
    <xsp:attribute
name="href">http://linuxsrv:8080/cocoon/wedamas/show.xsp?mid=<xsp:expr
>ref</xsp:expr></xsp:attribute>
        <esql:get-string column="mail_ID"/>       
</xsp-session:encode-url>

Result should be:
<a href="http://linuxsrv:8080/cocoon/wedamas/show.xsp?mid=1">1</a>

Result is:
<a xmlns:xspdoc="http://apache.org/cocoon/XSPDoc/v1"
xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp-formval="http://apache.org/xsp/form-validator/2.0"
href="">show.xsp?mid=ref_esql_query.getResultSet().getString("mail_ID"
)
           
                  </a>

I tried the way Beth Naquin told me, it works as far as I do not use
the <xsp-session:encode-url>-tag, but without the sessions it's kind
of useless code for my problem I think 
I tried also to write a similar <xsp-session:encode-url> XSL-Match
for my own uses, but if I add the lines which start the encoding (I
took it from the documentation of XSP) Cocoon says only a Java
Nullpointer Exception. Nothing in the logs, no further info.

Greets 
Georg

> pleasse re-read xsp documentation. in short:
> <a><xsp:attribute
> name="href">http://.....<xsp:expr>my_var</xsp:expr></xsp:attribute>C
> lick here</a>  
> 
> you may put anything (read: even any logicsheet tag and logic)
> inside this xsp:attribute
> 
> 
> Chris.
> 
> Please follow up summarizing your problem and which suggested
> solution / information worked for you when you consider your
> problem
> solved. Add "SUMMARY: " to the subject line. This will make FAQ
> generation and searching the list easier. In addition, it makes
> helping you more fun. Thank you.
> 
> -- 
> C h r i s t i a n       H a u l
> haul@informatik.tu-darmstadt.de
>     fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08
> 
> --------------------------------------------------------------------
> - Please check that your question  has not already been answered in
> the FAQ before posting.    
> <http://xml.apache.org/cocoon/faq/index.html>  
> 
> To unsubscribe, e-mail:    
> <co...@xml.apache.org> For additional commands,
> e-mail:   <co...@xml.apache.org>  
> 

- -----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use
<http://www.pgp.com>

iQA/AwUBPV2rS6ID3cBIHLXcEQJj/gCfa/7wWXqNT3CwXaOq3pGsQ8OlWpgAoLOl
DnF6XD65owQESBR/yrfz7MEg
=phTA
- -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPV2rp6ID3cBIHLXcEQIr3QCdFju2rBM//6UE/mFj1HLkNSrtQtcAoMoJ
A/mlNMmxcE3vVbPbgJ2jzx/E
=3Qth
-----END PGP SIGNATURE-----




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: problem with dynamic parameters in XSP + ESQL

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 16.Aug.2002 -- 06:03 PM, Georg Spar wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi @ll,
> 
> I 've got a problem with dynamic parameters in an XSP-ESQL-Combined
> Page.
> What I want to do:
> I just want to write a dynamically generated XSP-Page which put out
> the results of an ESQL-Query in a html-table. Each row of the table
> should have one <td>-tag with a link to another XSP-Page, where the
> user can view the whole entry of the database, and a few other
> <td>-tags only to inform the user.
> 
> In a scripting language like PHP this could be done very simple, the
> link look like that:
> http://show.xsp?mid=<? $mid ?> where $mid is the specific ID of the
> entry in the database-table 
> 
> How is this be done in Cocoon? 

pleasse re-read xsp documentation. in short:
<a><xsp:attribute name="href">http://.....<xsp:expr>my_var</xsp:expr></xsp:attribute>Click here</a>

you may put anything (read: even any logicsheet tag and logic)
inside this xsp:attribute


	Chris.

Please follow up summarizing your problem and which suggested solution
/ information worked for you when you consider your problem
solved. Add "SUMMARY: " to the subject line. This will make FAQ
generation and searching the list easier. In addition, it makes
helping you more fun. Thank you.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>