Package org.opencms.jsp
Class CmsJspTagJsonObject
- java.lang.Object
-
- javax.servlet.jsp.tagext.TagSupport
-
- javax.servlet.jsp.tagext.BodyTagSupport
-
- org.opencms.jsp.A_CmsJspJsonTag
-
- org.opencms.jsp.CmsJspTagJsonObject
-
- All Implemented Interfaces:
java.io.Serializable
,javax.servlet.jsp.tagext.BodyTag
,javax.servlet.jsp.tagext.IterationTag
,javax.servlet.jsp.tagext.JspTag
,javax.servlet.jsp.tagext.Tag
,I_CmsJspJsonContext
public class CmsJspTagJsonObject extends A_CmsJspJsonTag implements I_CmsJspJsonContext
Tag for defining a JSON object. Key-value pairs created by nested JSON tags will be added to the object.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CmsJspTagJsonObject()
Default constructor explicitly resetting all variables.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addValue(java.lang.String key, java.lang.Object val)
Adds a value to the JSON value being constructed.int
doStartTag()
java.lang.Object
getJsonValue()
Returns the JSON value that should be added to the surrounding context and/or stored in the variable given by the var attribute.protected void
init()
Initializes / resets the internal values.-
Methods inherited from class org.opencms.jsp.A_CmsJspJsonTag
addToTarget, doEndTag, getScope, release, setKey, setMode, setScope, setTarget, setVar
-
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent
-
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
-
-
-
-
Constructor Detail
-
CmsJspTagJsonObject
public CmsJspTagJsonObject()
Default constructor explicitly resetting all variables.
-
-
Method Detail
-
addValue
public void addValue(java.lang.String key, java.lang.Object val) throws javax.servlet.jsp.JspException
Description copied from interface:I_CmsJspJsonContext
Adds a value to the JSON value being constructed.For a JSON object, the key must be not null, and for a JSON array, it must always be null.
- Specified by:
addValue
in interfaceI_CmsJspJsonContext
- Parameters:
key
- the key (or null)val
- the value to add- Throws:
javax.servlet.jsp.JspException
- in case the value could not be added- See Also:
I_CmsJspJsonContext.addValue(java.lang.String, java.lang.Object)
-
doStartTag
public int doStartTag()
- Specified by:
doStartTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- See Also:
BodyTagSupport.doStartTag()
-
getJsonValue
public java.lang.Object getJsonValue()
Description copied from class:A_CmsJspJsonTag
Returns the JSON value that should be added to the surrounding context and/or stored in the variable given by the var attribute.- Specified by:
getJsonValue
in classA_CmsJspJsonTag
- Returns:
- the value to add/store
- See Also:
A_CmsJspJsonTag.getJsonValue()
-
init
protected void init()
Initializes / resets the internal values.- Overrides:
init
in classA_CmsJspJsonTag
-
-