|
From: <jue...@we...> - 2004-07-27 10:39:04
|
Darren, any thoughts on the current macros, particularly regarding the =
"springBind" and "springBindEscaped" naming? See the discussion in the =
mails below.
=20
It's already somewhat urgent, as I'd like to release 1.1 RC1 tonight :-)
=20
Juergen
=20
________________________________
Von: spr...@li... im Auftrag =
von j=FCrgen h=F6ller [werk3AT]
Gesendet: Sa 24.07.2004 21:28
An: spr...@li...
Betreff: Re: [Springframework-developer] Final preparations for 1.1 RC1
As far I see, there is no such overloading of macros in Velocity: If we =
have different parameters, we need to define a separate macro.
Even in FreeMarker, there's just the option to define a fixed default =
for optional parameters: no support for simply "not specified" (falling =
back to the default HTML escape setting in our case). That's why I =
suggest to use a different macro name there too, analogous to Velocity.
So the remaining issue are the names: "springBind" (default HTML escape =
setting) and "springBindEscaped" (explicitly specified HTML escape =
setting)?
Juergen
________________________________
Von: spr...@li... im Auftrag =
von Matt Raible
Gesendet: Sa 24.07.2004 20:44
An: spr...@li...
Betreff: Re: [Springframework-developer] Final preparations for 1.1 RC1
It would be nice if the method name didn't have to change and we could
just control the rendering of the variable. Probably not possible, but
something similar to JSP 2.0 where you use ${status.errorMessage} to
print out escaped XML and <c:out value=3D"${status.errorMessage}"
escapeXml=3D"false"/> if you want to print HTML.
I don't see a problem with having two separate methods: springBind and
springBindEscaped - just as long as its documented. Though it might be
nicer to have #springBind(path) and #springBind(path false) - where you
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
> "escape=3Dfalse" there, so do not participate in any default. This =
needs
> to be addressed: We should allow to work with the defaultHtmlEscape
> value here too.
>
> While we could introduce a further "escape" value for "use default",
> offering a special method signature for it, it's probably clearer two
> offer two FreeMarker macros: "spring:bind" which never takes an
> "escape" parameter (i.e. always uses the default), and
> "spring:bindEscaped" which takes a required "escape" parameter. This
> would be analogous to Velocity again then.
>
> However, there's still the naming issue: "bind" uses the default HTML
> escape setting. But how to the name the version that takes an explicit
> HTML escape parameter? Is there a better name than "bindEscaped"?
>
> This is easier with JSP tags, where there can be a true tag-internal
> default if the "setHtmlEscape" method was not called... As far as I
> can see, even FreeMarker just allows for an explicitly specified
> default in the macro definition: It cannot seamlessly invoke either
> RequestContext.createBindStatus(path) respectively
> RequestContext.createBindStatus(path, htmlEscape), in our concrete
> case.
>
> Juergen
>
>
> ________________________________
>
> Von: spr...@li... im Auftrag
> 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
> htmlEscape property from the "springBind" macro is to be able to
> participate in a RequestContext-level default, e.g. set via
> springMacroRequestContext.setDefaultHtmlEscape(true). Note that the
> createBindStatus invocation on RequestContext uses the
> defaultHtmlEscape flag then.
>
> I've just adapted the RequestContext implementation a bit further to
> also be able to participate in a ServletContext-level default, just
> like our JSP tags can, i.e. a "defaultHtmlEscape" context-param in
> web.xml. JSP tags and Velocity/FreeMarker macros can then even share
> such an application-wide default. I'll commit this promptly.
>
> Actually, the "springBindEscaped" macro should rather take an explicit
> htmlEscape parameter, to be able to override defaultHtmlEscape=3Dtrue =
to
> false for a specific macro. Hmm, what name could we use for this?
> "springBindWithExplicitEscape" is clearly too long... "springBind"
> with overloaded signature is not possible in Velocity... maybe still
> "springBindEscaped", but just with an explicit parameter?
>
>
> Matt,
>
> Note that the "springMacroRequestContext" is not really meant to be
> accessed directly; it is mainly meant to be used by Spring-provided
> macros. If you want to use a RequestContext in your own expressions,
> always specify the "requestContextAttribute" accordingly. We should
> highlight that in the docs.
>
>
> Juergen
>
>
> ________________________________
>
> Von: spr...@li... im Auftrag
> 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/
>> 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
> 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
> templates.
>
>
> I prefer personally to always require the additional parameter. It's
> more
> consistent with FM and won't cause user templates to break if they
> 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
>> "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
-------------------------------------------------------
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
|