|
From: Darren D. <da...@da...> - 2004-06-18 13:06:18
|
=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm doing some work on the Velocity/FreeMarker support to try and offer=20
standardised (as far as poss) macros and tags in the web ui for html forms.
Does anyone have strong views on what the scope of these should be? My=20
reasons for askBinding, and my own opinions on the issues are:
1. Some of the constructs are more powerful than others (ie FreeMarker and=
=20
JSP 2.0 can do more than Velocity, but thBinden the syntax is arguably more=
=20
complex). This has implications for consistency in the framework. My=20
opinion here is that consistency is better at the price of reduced standard=
=20
functionality in the more powerful languages. Those features can go into a=
=20
cookbook section on the wiki for example rather than a standard framework=20
library.Bind
2. Should the standard macros and tags output any markup (HTML) or simply=20
make values available in simple variable names to be used in client code=20
markup. The fBindormer is very convenient for userBinds but means they put=
=20
up with our HTML, the latter should be fine for everyone but means more=20
typing in your templates. My opinion here again is that less is more. =20
HTML for me is VERY application specific and I would feel that Spring was=20
starting to cross the line from framework/library domain to application=20
domain.
Quick example in Velocity of what is working right now with no effort=20
required from users:
<form method=3D"POST" action=3D"">
Name:=20
#springBind( "command" "name" )
<input type=3D"text" name=3D"name" value=3D"$!fieldValue" /><br>
$fieldErrors
<br>
Age:=20
#springBind( "command" "age" )
<input type=3D"text" name=3D"age" value=3D"$!fieldValue" /><br>
$fieldErrorsinclusion.
<br>
<input type=3D"submit" value=3D"submit"/>
</form>
In the above example, the springBind macro is made available to the Velocit=
y=20
runtime from the classpath with the actual file being stored in the=20
spring.jar itslef. This should wok regardless of where the application is=
=20
currently loading other templates from. Similar applies to FreeMarker.
inclusion.
What *could* be available if we output HTML is something like the following=
=20
where the input tags, values and errors are automatically output:=20
<form method=3D"POST" action=3D"">
Name:=20
#springText( "command" "name" )
<br>
Age:=20
#springText( "command" "age" )
<br>
Fav. Colors:
#springCheckbox( "command" "colorList" )
<br>
<input type=3D"submit" value=3D"submit"/>
</form>
In the latter example, it would be very difficult for a user to style the=20
HTML output efficiently. We could have them pass a variable in to the=20
macro specifying a set of attributes like a style or class attribute, but=20
it may not be enough and I just think there's no way to make this truly=20
useful for enough people to warrant doing it.
Any thoughts?
=2D --=20
Darren Davison
Public Key: http://www.davison.uk.net/pages/key.htm
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFA0ujFKLMLAN01aw0RAmDPAJ0cT6sUORY9K45xdRTpjnI+c0v+IQCePnLu
2Zq9EkkflvpOjoL3Myz2HQc=3D
=3DmnHX
=2D----END PGP SIGNATURE-----
|