struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From victor sosa <>
Subject request for contributtions or enhancements
Date Tue, 22 Jan 2008 18:53:22 GMT

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:

		<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">
     	<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:jsonarray name="maquinas" items="%{maquinas}">
				<jsongl:jsonproperty name="codigo" value="%{codigo}" />
				<jsongl:jsonproperty name="metro" value ="%{metro}"/>
		<jsongl:jsonarray name="array3" items="%{maquinas}">
			<jsongl:jsonproperty value="%{codigo}"/>
	    <jsongl:jsonarray name="array2">
		    <jsongl:jsonproperty value="jkl"/>
    		<jsongl:jsonproperty value="mno"/>
		    <jsongl:jsonproperty value="pqr"/>
		<jsongl:jsonarray name="emptyArray">

Result page:

<script type="text/javascript">
var valueStack = {
  "array3": [
  "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": [
  "emptyArray": [],
  "numeric3": "123.456",
  "numeric1": "3"

- 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.

- 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:
Sent from the Struts - Dev mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message