cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From olivier demah <ode...@messagio.com>
Subject XSP : for (...)
Date Tue, 20 Apr 2004 08:11:47 GMT
Hi,

When i submit a form which contains a select multiple ; i need to store 
the selected datas in a table
so i try to do

<?xml version="1.0" encoding="iso-8859-1"?>
<xsp:page   xmlns:xsp= "http://apache.org/xsp"
            xmlns:xsp-request= "http://apache.org/xsp/request/2.0"
            xmlns:esql="http://apache.org/cocoon/SQL/v2"
            xmlns:cinclude="http://apache.org/cocoon/include/1.0">
<root>
<cinclude:include src="cocoon:/admin_index.xml" />
<players>
<xsp:logic>

String id_player            = request.getParameter("id_player");
String[] id_club            = request.getParameter("id_club");
int nbClub = id_club.length;
int i = 0;

for (i = 0; i < nbClub ; i++) {
    <esql:connection>
        <esql:pool>my_pool</esql:pool>
        <esql:execute-query>
            <esql:query>INSERT INTO m_club_player (id_player,id_club) 
VALUES (
                        id_player = <esql:parameter 
type="string"><xsp:expr>id_player</xsp:expr></esql:parameter>,
                        id_club = <esql:parameter 
type="string"><xsp:expr>id_club[i]</xsp:expr></esql:parameter> );
            </esql:query>
            <esql:error-results/>
            <esql:update-results>
                <esql:get-update-count/>
            </esql:update-results>
        </esql:execute-query>
    </esql:connection>
}

</xsp:logic>
</players>
</root>
</xsp:page>

i know i dont test if id_club.length > 0 but anyway ; the previous code 
just display :
org.apache.cocoon.ProcessingException: The content of elements must 
consist of well-formed character data or markup.: 
file:/home/fox_cocoon/build/webapp/vieira/admin/xsp/player.xsp:29:16:org.xml.sax.SAXParseException:

The content of elements must consist of well-formed character data or 
markup.
and the line 29 is the "for (i=0"...

could not we do a for loop to execute multiple queries ?
do i have to merge to flow ? :-(




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


Mime
View raw message