You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lionel Crine <cr...@4dconcept.fr> on 2003/09/29 14:29:39 UTC

[xsp] Why this does not work ?

<xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-cookie="http://apache.org/xsp/cookie/2.0"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:xsp-session="http://apache.org/xsp/session/2.0"
xmlns:util="http://apache.org/xsp/util/2.0" create-session="false">
   <xsp:structure>
     <xsp:include>com._4d.utils.UtilsFunction</xsp:include>
   </xsp:structure>
   <modification><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:attribute name="id"><xsp:expr>modifid</xsp:expr></xsp:attribute>
     <modificationadm>
       <modificationnum>
           <xsp:expr><xsp-request:get-parameter name="ref" /></xsp:expr>
       </modificationnum>
       <modificationdesc>
         <xsp:expr>
           <xsp-request:get-parameter name="description" />
         </xsp:expr>
       </modificationdesc>
       <xsp:element name="status">
         <xsp:attribute name="status">
           <xsp:expr>
             <util:get-sitemap-parameter name="status" />
           </xsp:expr>
         </xsp:attribute>
       </xsp:element>
       <date />
     </modificationadm>
     <modificationbody />
   </modification>
</xsp:page>

I have this error message : "modifid cannot be resolved" --> Why ?

Lionel

Lionel CRINE
Ingénieur Systèmes documentaires
Société : 4DConcept
22 rue Etienne de Jouy 78353 JOUY EN JOSAS
Tel : 01.34.58.70.70 Fax : 01.39.58.70.70


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


Re: [xsp] Why this does not work ?

Posted by Sylvain Wallez <sy...@anyware-tech.com>.
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: [xsp] Why this does not work ?

Posted by Lionel Crine <cr...@4dconcept.fr>.
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.

Thanks.

At 08:48 29/09/2003 -0400, you wrote:
>Lionel Crine wrote:
>><xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
>>xmlns:xsp-cookie="http://apache.org/xsp/cookie/2.0"
>>xmlns:xsp-request="http://apache.org/xsp/request/2.0"
>>xmlns:xsp-session="http://apache.org/xsp/session/2.0"
>>xmlns:util="http://apache.org/xsp/util/2.0" create-session="false">
>>   <xsp:structure>
>>     <xsp:include>com._4d.utils.UtilsFunction</xsp:include>
>>   </xsp:structure>
>>   <modification>
>>     <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>
>>     <modificationadm>
>>       <modificationnum>
>>           <xsp:expr><xsp-request:get-parameter name="ref" /></xsp:expr>
>>       </modificationnum>
>>       <modificationdesc>
>>         <xsp:expr>
>>           <xsp-request:get-parameter name="description" />
>>         </xsp:expr>
>>       </modificationdesc>
>>       <xsp:element name="status">
>>         <xsp:attribute name="status">
>>           <xsp:expr>
>>             <util:get-sitemap-parameter name="status" />
>>           </xsp:expr>
>>         </xsp:attribute>
>>       </xsp:element>
>>       <date />
>>     </modificationadm>
>>     <modificationbody />
>>   </modification>
>></xsp:page>
>>I have this error message : "modifid cannot be resolved" --> Why ?
>
>Because attributes have to be set up before the start of the element they 
>are attached to.  Look at the java file your xsp is converted to under 
>your servlet containers work directory - it'll be more obvious.
>I made a change above that should work - you could clean it up but that's 
>the basic idea.
>
>Geoff
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org

Lionel CRINE
Ingénieur Systèmes documentaires
Société : 4DConcept
22 rue Etienne de Jouy 78353 JOUY EN JOSAS
Tel : 01.34.58.70.70 Fax : 01.39.58.70.70


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


Re: [xsp] Why this does not work ?

Posted by Lionel Crine <cr...@4dconcept.fr>.
Yes, that's no influence. Only the place of the <xsp:logic> tag returns an 
error.


At 08:51 29/09/2003 -0400, you wrote:
>Geoff Howard wrote:
>>Lionel Crine wrote:
>
>...
>
>>>I have this error message : "modifid cannot be resolved" --> Why ?
>>Because attributes have to be set up before the start of the element they 
>>are attached to.  Look at the java file your xsp is converted to under 
>>your servlet containers work directory - it'll be more obvious.
>>I made a change above that should work - you could clean it up but that's 
>>the basic idea.
>
>Sorry, left out the detail that even though the xsp:attribute tag follows 
>its element, the java code it results in is executed before the code to 
>create that element (because attributes have to be set up before...)
>
>Geoff
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org

Lionel CRINE
Ingénieur Systèmes documentaires
Société : 4DConcept
22 rue Etienne de Jouy 78353 JOUY EN JOSAS
Tel : 01.34.58.70.70 Fax : 01.39.58.70.70


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


Re: [xsp] Why this does not work ?

Posted by Geoff Howard <co...@leverageweb.com>.
Geoff Howard wrote:
> Lionel Crine wrote:

...

>> I have this error message : "modifid cannot be resolved" --> Why ?
> 
> Because attributes have to be set up before the start of the element 
> they are attached to.  Look at the java file your xsp is converted to 
> under your servlet containers work directory - it'll be more obvious.
> I made a change above that should work - you could clean it up but 
> that's the basic idea.

Sorry, left out the detail that even though the xsp:attribute tag 
follows its element, the java code it results in is executed before the 
code to create that element (because attributes have to be set up before...)

Geoff


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


Re: [xsp] Why this does not work ?

Posted by Geoff Howard <co...@leverageweb.com>.
Lionel Crine wrote:
> <xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
> xmlns:xsp-cookie="http://apache.org/xsp/cookie/2.0"
> xmlns:xsp-request="http://apache.org/xsp/request/2.0"
> xmlns:xsp-session="http://apache.org/xsp/session/2.0"
> xmlns:util="http://apache.org/xsp/util/2.0" create-session="false">
>   <xsp:structure>
>     <xsp:include>com._4d.utils.UtilsFunction</xsp:include>
>   </xsp:structure>
>   <modification>
>     <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>
>     <modificationadm>
>       <modificationnum>
>           <xsp:expr><xsp-request:get-parameter name="ref" /></xsp:expr>
>       </modificationnum>
>       <modificationdesc>
>         <xsp:expr>
>           <xsp-request:get-parameter name="description" />
>         </xsp:expr>
>       </modificationdesc>
>       <xsp:element name="status">
>         <xsp:attribute name="status">
>           <xsp:expr>
>             <util:get-sitemap-parameter name="status" />
>           </xsp:expr>
>         </xsp:attribute>
>       </xsp:element>
>       <date />
>     </modificationadm>
>     <modificationbody />
>   </modification>
> </xsp:page>
> 
> I have this error message : "modifid cannot be resolved" --> Why ?

Because attributes have to be set up before the start of the element 
they are attached to.  Look at the java file your xsp is converted to 
under your servlet containers work directory - it'll be more obvious.
I made a change above that should work - you could clean it up but 
that's the basic idea.

Geoff



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