Package nl.gx.webmanager.taglib
Class ObjectTag
- java.lang.Object
-
- javax.servlet.jsp.tagext.SimpleTagSupport
-
- nl.gx.webmanager.taglib.ObjectTag
-
- All Implemented Interfaces:
javax.servlet.jsp.tagext.JspTag
,javax.servlet.jsp.tagext.SimpleTag
public class ObjectTag extends javax.servlet.jsp.tagext.SimpleTagSupport
Implements thewm:object
tag. Retrieves an object from the content database. In GX WebManager, the content database is filled with objects that have an id and a type. For GX WebManager objects that are exposed through the Java API, wrapper classes are available that encapsulate the data that is stored in the content database. The public API of these wrapper classes is defined in interfaces. The < wm:object > tag can be used as a factory for creating wrapper objects based on the type and objectid. The type is the fully qualified class name of the wrapper interface. If no wrapper object can be created (either the id or the type is wrong), the value null is used.
Example of usage:< wm:object var="message" objectId="${param.message}" objectType="nl.gx.webmanager.cms.forum.ForumMessage" /> < wm:render object="${message}" />
The example above assigns a ForumMessage object to the variable 'message'. Some tags like, for example, < wm:render > have an attribute object. The variable may be used in such tags.
-
-
Constructor Summary
Constructors Constructor Description ObjectTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doTag()
boolean
getHideError()
If true, the error logged when it failed to create the specified object, for example because no object with the specified id exists, is logged on FINE level.protected int
getObjectId()
Return the numerical id of the object to retrieve.protected String
getObjectType()
Return the Java class of the object to retrieve.protected String
getVar()
Return the JSP variable to store the result in.void
setHideError(boolean hideError)
If set to true, the error logged when it failed to create the specified object, for example because no object with the specified id exists, is logged on FINE level.void
setObjectId(int objectId)
Sets the numerical id of the object to retrieve.void
setObjectType(String objectType)
Specifies the Java class of the object to retrieve.void
setVar(String var)
Specifies the JSP variable to store the result in.
-
-
-
Method Detail
-
setVar
public void setVar(String var)
Specifies the JSP variable to store the result in.- Parameters:
var
- name of the jsp variable to which the object will be assigned.
-
getVar
protected String getVar()
Return the JSP variable to store the result in.- Returns:
- name of the jsp variable to which the object will be assigned.
-
getHideError
public boolean getHideError()
If true, the error logged when it failed to create the specified object, for example because no object with the specified id exists, is logged on FINE level. If false, this error is logged on WARNING level.- Returns:
- true when the tag logs the error on FINE level when the object could not be created, false if it logs on WARNING level
-
setHideError
public void setHideError(boolean hideError)
If set to true, the error logged when it failed to create the specified object, for example because no object with the specified id exists, is logged on FINE level. If false, this error is logged on WARNING level.- Parameters:
hideError
- if true, the tag logs the error on FINE level when the object could not be created, is false it logs the error on WARNING level
-
setObjectId
public void setObjectId(int objectId)
Sets the numerical id of the object to retrieve.- Parameters:
objectId
- the numerical id of the object to retrieve.
-
getObjectId
protected int getObjectId()
Return the numerical id of the object to retrieve.- Returns:
- objectid of the object
-
setObjectType
public void setObjectType(String objectType)
Specifies the Java class of the object to retrieve. The objectType should be a fully qualified classname. Note there are some deprecated abbreviations for some classes which are still supported. You should always use the fully qualified classname. In future releases, support for the abbreviations may be dropped.- Parameters:
objectType
- the objecttype of the object
-
getObjectType
protected String getObjectType()
Return the Java class of the object to retrieve. The objectType is a fully qualified classname.- Returns:
- the objecttype of the object
-
doTag
public void doTag()
- Specified by:
doTag
in interfacejavax.servlet.jsp.tagext.SimpleTag
- Overrides:
doTag
in classjavax.servlet.jsp.tagext.SimpleTagSupport
-
-