org.mentawai.ajax.renderer
Class MapAjaxRenderer

java.lang.Object
  extended by org.mentawai.ajax.renderer.MapAjaxRenderer
All Implemented Interfaces:
AjaxRenderer

public class MapAjaxRenderer
extends java.lang.Object
implements AjaxRenderer

A AjaxRender that gets map from the action`s output and creates a XML structure with the contents of this map.

For example, a Map with this content:

 |      key      |      value      |
 |     akey      |      avalue     |
 | yetAnotherKey | yetAnotherValue |
 

Would create the folowing XML structure:
 <map>
     <entry key="akey">avalue</entry>
     <entry key="yetAnotherKey">yetAnotherValue</entry>
  </map>   
 

The tag names ("map" & "entry") may be changed.

Then you can use your favorite JavaScript parser (or use your own) to parse the generated XML strucure and interact it in your code.

Author:
Rubem Azenha (rubem.azenha@gmail.com), Fernando Boaglio - update to jdom 1.0

Field Summary
static java.lang.String CHILD
           
static java.lang.String FATHER
           
static java.lang.String KEY
           
 
Fields inherited from interface org.mentawai.ajax.AjaxRenderer
APP_JSON, APP_URLENCODED, TEXT_HTML, TEXT_XML
 
Constructor Summary
MapAjaxRenderer()
           
MapAjaxRenderer(java.lang.String root, java.lang.String child, java.lang.String key)
           
 
Method Summary
 java.lang.String encode(java.lang.Object obj, java.util.Locale loc, boolean pretty)
           
 java.lang.String getCharset()
           
 java.lang.String getContentType()
           
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FATHER

public static final java.lang.String FATHER
See Also:
Constant Field Values

CHILD

public static final java.lang.String CHILD
See Also:
Constant Field Values

KEY

public static final java.lang.String KEY
See Also:
Constant Field Values
Constructor Detail

MapAjaxRenderer

public MapAjaxRenderer(java.lang.String root,
                       java.lang.String child,
                       java.lang.String key)

MapAjaxRenderer

public MapAjaxRenderer()
Method Detail

encode

public java.lang.String encode(java.lang.Object obj,
                               java.util.Locale loc,
                               boolean pretty)
                        throws java.lang.Exception
Specified by:
encode in interface AjaxRenderer
Throws:
java.lang.Exception

getContentType

public java.lang.String getContentType()
Specified by:
getContentType in interface AjaxRenderer

getCharset

public java.lang.String getCharset()
Specified by:
getCharset in interface AjaxRenderer

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2005 Mentawai Team. All Rights Reserved.