I have done a tab libs that add a new feature to struts 2 Right now a name it jsongl because use json language and ongl (I mean value stack), This tag put into the result page the data from the value stack specify by the tag as a javascript variable named valueStack, this variable is declared as json object, so you can now access any value from value stack using simple json notation in javascript.
So any suggestion? for example: example.jsp <jsongl:jsonobject> <jsongl:jsonproperty name="venta" value="%{venta.fecha}"/> <jsongl:jsonproperty name="fecha" value="%{venta.fecha}"/> <jsongl:jsonproperty name="bool1" value="%{true}"/> <jsongl:jsonproperty name="numeric1" value="%{1+2}"/> <jsongl:jsonproperty name="numeric2" value="%{-500}"/> <jsongl:jsonproperty name="numeric3" value="%{123.456}"/> <jsongl:jsonproperty name="fecha"> %{venta.fecha} </jsongl:jsonproperty> <jsongl:jsonobject name="inner"> <jsongl:jsonproperty name="innerProp1" value="val1"/> <jsongl:jsonproperty name="innerProp2" value="val2"/> <jsongl:jsonobject name="inner2"> <jsongl:jsonproperty name="inner2Prop1" value="in2p1"/> <jsongl:jsonproperty name="inner2Prop2" value="in2p2"/> </jsongl:jsonobject> </jsongl:jsonobject> <jsongl:jsonarray name="maquinas" items="%{maquinas}"> <jsongl:jsonobject> <jsongl:jsonproperty name="codigo" value="%{codigo}" /> <jsongl:jsonproperty name="metro" value ="%{metro}"/> </jsongl:jsonobject> </jsongl:jsonarray> <jsongl:jsonarray name="array3" items="%{maquinas}"> <jsongl:jsonproperty value="%{codigo}"/> </jsongl:jsonarray> <jsongl:jsonarray name="array2"> <jsongl:jsonproperty value="jkl"/> <jsongl:jsonproperty value="mno"/> <jsongl:jsonproperty value="pqr"/> </jsongl:jsonarray> <jsongl:jsonarray name="emptyArray"> </jsongl:jsonarray> </jsongl:jsonobject> Result page: <script type="text/javascript"> var valueStack = { "array3": [ "m1", "m2" ], "maquinas": [ { "metro": "125463", "codigo": "m1" }, { "metro": "12563664", "codigo": "m2" } ], "venta": "1/22/08", "numeric2": "-500", "inner": { "inner2": { "inner2Prop1": "in2p1", "inner2Prop2": "in2p2" }, "innerProp2": "val2", "innerProp1": "val1" }, "bool1": "true", "array2": [ "jkl", "mno", "pqr" ], "emptyArray": [], "numeric3": "123.456", "numeric1": "3" } </script> Pros: - is more simple develop of custom component that use the value stack - you don't need to learn a new language (freemaker, etc), just use simple javascript to access the data into value stack - you can access any value on the value stack from javascript code, and do a more interactive page. - simple to use and access only the data that is needed. Cons: - is no real time, is the value stack change after request the javascript value stack doesn't change. (I think this is not a problem really). -- View this message in context: http://www.nabble.com/request-for-contributtions-or-enhancements-tp15025525p15025525.html Sent from the Struts - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]