cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ovidiu Predescu <ovi...@apache.org>
Subject Re: Flow wishlist :)
Date Thu, 05 Dec 2002 18:33:07 GMT

On Thursday, Dec 5, 2002, at 08:06 US/Pacific, Christopher Oliver wrote:

>
> Ovidiu Predescu wrote:
>
>>> Instead of putting in "convenience" features like this I think it  
>>> would be more valuable to make other view layers (Velocity, JSP's)  
>>> accessible to the flow layer. If someone familiar with the internals  
>>> of Cocoon wants to help me out I'd be interested in contributing to  
>>> this.
>>
>>
>> I could help you here. You've already done work for Velocity, it's  
>> just a matter of integrating them in the current system.
>
> OK. Then we need some way of populating the Velocity context with the  
> argument from sendPage() and the WebContinuation object. What's the  
> best way of doing this? Also the Velocity introspector I wrote for  
> JavaScript requires Velocity 1.4 dev. Is that going to be a problem?

I don't have much experience developing with Velocity, however by  
quickly glancing at the documentation it appears the Velocity class has  
a setProperty() method which we can make use of to set the individual  
key-value pairs of the business object dictionary and the continuation  
object:

http://jakarta.apache.org/velocity/api/org/apache/velocity/app/ 
Velocity.html#setProperty(java.lang.String,%20java.lang.Object)

>>
>> With respect to JSP, I think we can directly use JSTL which has  
>> strikingly similar features as the JPath logicsheet. The only  
>> difference is that instead of an XPath notation to access objects, it  
>> uses a dotted notation. Other than that the features are very >>  
>> similar.
>
> OK. Then I guess I'd have basically the same question here. What's the  
> best way to make the sendPage() argument and continuation object  
> accessible to JSTL?

In a pure servlet environment we could use  
HTTPServletRequest.setAttribute to set named properties, which could  
then be accessed using normal JSTL expressions.

Cocoon however doesn't forward the request to a VelocityServlet or JSP  
page for initial page processing. Instead it has a Generator wrapper  
around them, so the mechanisms are a bit different. The control flow  
itself passes the object dictionary and the continuation object in an  
Environment object, under the 'bean-dict' and 'kont' keys.

For Velocity, we could modify  
org.apache.cocoon.generation.VelocityGenerator such that the generate()  
method looks up in the environment for the objects registered under the  
above mentioned keys, and merges them in the context passed to the  
template.

Strangely I couldn't find the JSP support in  
org.apache.cocoon.generation, although I do remember seeing something  
like JSPReader. Perhaps somebody else can enlighten us in this area.

Best regards,
Ovidiu

-- 
Ovidiu Predescu <ovidiu@apache.org>
http://webweavertech.com/ovidiu/weblog/


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


Mime
View raw message