Lionel Crine wrote:

I found a thread that helped me :



I wrote :

<xsp:logic>
String id = (String)<xsp:expr><xsp-session:get-attribute name="ID" /></xsp:expr>;
String modifid = UtilsFunction.getInstance().generateID(id, System.currentTimeMillis());
<xsp:attribute name="id"><xsp:expr>modifid</xsp:expr></xsp:attribute>
</xsp:logic>



instead of :


> <xsp:attribute name="id">
> <xsp:logic>String id = (String)<xsp:expr><xsp-session:get-attribute name="ID" /></xsp:expr>;String modifid =
> UtilsFunction.getInstance().generateID(id, System.currentTimeMillis());</xsp:logic>
> <xsp:expr>modifid</xsp:expr>
> </xsp:attribute>


The xsp:logic should contain the xsp:attribute.


That's because of the SAX nature of Cocoon pipelines : you can't add an attribute after an element is started (or "opened" from the XSP source point of view).

So there's a special handing of <xsp:attribute> instructions nested in an <xsp:logic> : the corresponding code produced _before_ the code corresponding to the element start.

That's why all java instructions related to an <xsp:attribute> must be either in an enclosing <xsp:logic> or before the element opening tag.

Sylvain

--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to