|
From: <jue...@we...> - 2004-11-21 19:43:46
|
Good suggestions! Actually, an "exposeToolAttributes" method has already =
been factored out since 1.1.2.
=20
I've also implemented your second suggestion: a factored out =
"doRender(Context, HttpServletResponse)" method that determines the =
template instance via the "url" bean property and delegates to the =
existing "mergeTemplate" method for the actual merging of template and =
Velocity context.
=20
"mergeTemplate" needs the template parameter because we support fresh =
fetching of the template instance from the VelocityEngine for each =
rendering. The VelocityEngine itself will cache the template, so this is =
a viable strategy. If turning the "cacheTemplate" property to "true", =
VelocityView itself will cache the template instance too (which is =
slightly more efficient than Velocity's own caching, but doesn't check =
whether the template file has changed).
=20
In your case, you should be able to override "doRender" and call =
"mergeTemplate" for each of the templates that you want to render. The =
template model will already be complete when passed into "doRender", so =
should not need to worry about exposing the helpers and tool attributes.
=20
Please have a look at the current version of VelocityView in CVS and =
check whether it meets your needs! I'll commit it promptly, so it should =
be visible in public CVS by tomorrow morning at the latest.=20
=20
Juergen
=20
________________________________
Von: spr...@li... im Auftrag =
von Roberto Cosenza
Gesendet: Fr 19.11.2004 23:31
An: spr...@li...
Betreff: Re: [Springframework-developer] Subclassing VelocityView
Yes,
a) I would refactor the method renderMergedTemplateModel extracting the =
code
that puts in the Context the different formatters and tools.
Of course, I'd make it protected in order to be overridden.
b) mergeTemplate should not take the Template argument. Template is an
instance variable, so it doesn't need to be passed in.
It could be renamed into "mergeContext" instead. In this way one =
could
use the context the merge more than one templates as in my case nicely.
Hope I made clear my ideas and that they make sense to you all.
/robcos
----- Original Message -----
From: "j=FCrgen h=F6ller [werk3AT]" <jue...@we...>
To: <spr...@li...>
Sent: Friday, November 19, 2004 4:25 PM
Subject: Re: [Springframework-developer] Subclassing VelocityView
OK, I see. I'll add an "isCacheTemplate" getter. Do you have any other
suggestions on how to improve VelocityView in terms of easy subclassing?
Juergen
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|