cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jan Hoskens" ...@schaubroeck.be>
Subject Re: for (...)
Date Tue, 20 Apr 2004 08:25:18 GMT
In your XSP you're not allowed to use < > and other xml characters that
serve special purposes (you're still in xml while writing java!)
thus replace "i <" in for with "i &lt;"   or set a CDATA section around it
so that xml will copy it literally.

Kind Regards,
Jan

----- Original Message ----- 
From: "olivier demah" <odemah@messagio.com>
To: <users@cocoon.apache.org>
Sent: Tuesday, April 20, 2004 10:11 AM
Subject: XSP : for (...)


> 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
>


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


Mime
View raw message