|
From: Matt R. <li...@ra...> - 2004-07-24 18:44:48
|
It would be nice if the method name didn't have to change and we could=20=
just control the rendering of the variable. Probably not possible, but=20=
something similar to JSP 2.0 where you use ${status.errorMessage} to=20
print out escaped XML and <c:out value=3D"${status.errorMessage}"=20
escapeXml=3D"false"/> if you want to print HTML.
I don't see a problem with having two separate methods: springBind and=20=
springBindEscaped - just as long as its documented. Though it might be=20=
nicer to have #springBind(path) and #springBind(path false) - where you=20=
have to use two parameters to escape XML.
Matt
On Jul 24, 2004, at 10:19 AM, j=FCrgen h=F6ller [werk3AT] wrote:
> Actually, the same issue occurs with FreeMarker too: We specify=20
> "escape=3Dfalse" there, so do not participate in any default. This =
needs=20
> to be addressed: We should allow to work with the defaultHtmlEscape=20
> value here too.
>
> While we could introduce a further "escape" value for "use default",=20=
> offering a special method signature for it, it's probably clearer two=20=
> offer two FreeMarker macros: "spring:bind" which never takes an=20
> "escape" parameter (i.e. always uses the default), and=20
> "spring:bindEscaped" which takes a required "escape" parameter. This=20=
> would be analogous to Velocity again then.
>
> However, there's still the naming issue: "bind" uses the default HTML=20=
> escape setting. But how to the name the version that takes an explicit=20=
> HTML escape parameter? Is there a better name than "bindEscaped"?
>
> This is easier with JSP tags, where there can be a true tag-internal=20=
> default if the "setHtmlEscape" method was not called... As far as I=20
> can see, even FreeMarker just allows for an explicitly specified=20
> default in the macro definition: It cannot seamlessly invoke either=20
> RequestContext.createBindStatus(path) respectively=20
> RequestContext.createBindStatus(path, htmlEscape), in our concrete=20
> case.
>
> Juergen
>
>
> ________________________________
>
> Von: spr...@li... im Auftrag=20=
> von j=FCrgen h=F6ller [werk3AT]
> Gesendet: Sa 24.07.2004 15:12
> An: spr...@li...
> Betreff: Re: [Springframework-developer] Final preparations for 1.1 =
RC1
>
>
>
> Darren,
>
> Oops, I forgot to discuss that one: The reason why I removed the=20
> htmlEscape property from the "springBind" macro is to be able to=20
> participate in a RequestContext-level default, e.g. set via=20
> springMacroRequestContext.setDefaultHtmlEscape(true). Note that the=20
> createBindStatus invocation on RequestContext uses the=20
> defaultHtmlEscape flag then.
>
> I've just adapted the RequestContext implementation a bit further to=20=
> also be able to participate in a ServletContext-level default, just=20
> like our JSP tags can, i.e. a "defaultHtmlEscape" context-param in=20
> web.xml. JSP tags and Velocity/FreeMarker macros can then even share=20=
> such an application-wide default. I'll commit this promptly.
>
> Actually, the "springBindEscaped" macro should rather take an explicit=20=
> htmlEscape parameter, to be able to override defaultHtmlEscape=3Dtrue =
to=20
> false for a specific macro. Hmm, what name could we use for this?=20
> "springBindWithExplicitEscape" is clearly too long... "springBind"=20
> with overloaded signature is not possible in Velocity... maybe still=20=
> "springBindEscaped", but just with an explicit parameter?
>
>
> Matt,
>
> Note that the "springMacroRequestContext" is not really meant to be=20
> accessed directly; it is mainly meant to be used by Spring-provided=20
> macros. If you want to use a RequestContext in your own expressions,=20=
> always specify the "requestContextAttribute" accordingly. We should=20
> highlight that in the docs.
>
>
> Juergen
>
>
> ________________________________
>
> Von: spr...@li... im Auftrag=20=
> von Darren Davison
> Gesendet: Sa 24.07.2004 10:18
> An: spr...@li...
> Betreff: Re: [Springframework-developer] Final preparations for 1.1 =
RC1
>
>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Saturday 24 July 2004 01:09, Matt Raible wrote:
>> I tried this out today and it works well. The only thing I saw that
>> might cause confusion for users is there are 2 macros for Velocity
>> (#springBind and #springBindEscaped) - whereas FreeMarker has one w/=20=
>> an
>> "escape" parameter. I imagine that folks using FreeMarker might be
>> migrating from Velocity, so making the macros consistent might be
>> helpful. Who knows - just a thought.
>
> FreeMarker has a default value of false for the 2nd param so you only=20=
> need
> supply it to override it. Velocity can't do that.
>
> The other options for Velocity are:
>
> * always supply the second parameter in every call to springBind
>
> * use a globally scoped, well-known variable defined in user=20
> templates.
>
>
> I prefer personally to always require the additional parameter. It's=20=
> more
> consistent with FM and won't cause user templates to break if they=20
> migrate
> them to FM using the automatic conversion tool they have available.
>
> What do you think?
>
>
>> I would make sure and document that the name=20
>> "springMacroRequestContext"
>> can be overridden by specifying a "requestContextAttribute" property.
>> It's much easier to write $rc.getMessage() than
>> $springMacroRequestContext.getMessage(). ;-)
>
> I will, thanks.
>
> - --
> Darren Davison
> Public Key: http://www.davison.uk.net/pages/key.htm
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (GNU/Linux)
>
> iD8DBQFBAhtIKLMLAN01aw0RAisgAKCfjnl6dzgkdQ91o9lUrUvtd9RGWQCfRJNq
> cn71Z/8ovFjaDLQRxtBwTfo=3D
> =3Dlvg2
> -----END PGP SIGNATURE-----
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_idG21&alloc_id=10040&op=3Dick
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_idG21&alloc_id=10040&op=3Dick
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_idG21&alloc_id=10040&op=CCk
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
|