Save This Page
Home » struts-2.1.8.1-src » org.apache » struts2 » components » [javadoc | source]
org.apache.struts2.components
abstract public class: UIBean [javadoc | source]
java.lang.Object
   org.apache.struts2.components.Component
      org.apache.struts2.components.UIBean
UIBean is the standard superclass of all Struts UI componentns. It defines common Struts and html properties all UI components should present for usage.
Attribute Theme Data Types Description
templateDir n/a String define the template directory
theme n/a String define the theme name
template n/a String define the template name

Attribute Theme Data Types Description
cssClass simple String define html class attribute
cssStyle simple String define html style attribute
cssClass simple String error class attribute
cssStyle simple String error style attribute
title simple String define html title attribute
disabled simple String define html disabled attribute
label xhtml String define label of form element
labelPosition xhtml String define label position of form element (top/left), default to left
requiredposition xhtml String define required label position of form element (left/right), default to right
name simple String Form Element's field name mapping
required xhtml Boolean add * to label (true to add false otherwise)
tabIndex simple String define html tabindex attribute
value simple Object define value of form element

Attribute Theme Data Types Description
onclick simple String html javascript onclick attribute
ondblclick simple String html javascript ondbclick attribute
onmousedown simple String html javascript onmousedown attribute
onmouseup simple String html javascript onmouseup attribute
onmouseover simple String html javascript onmouseover attribute
onmouseout simple String html javascript onmouseout attribute
onfocus simple String html javascript onfocus attribute
onblur simple String html javascript onblur attribute
onkeypress simple String html javascript onkeypress attribute
onkeyup simple String html javascript onkeyup attribute
onkeydown simple String html javascript onkeydown attribute
onselect simple String html javascript onselect attribute
onchange simple String html javascript onchange attribute

Attribute Data Type Default Description
tooltip String none Set the tooltip of this particular component
jsTooltipEnabled String false Enable js tooltip rendering
tooltipIcon String /struts/static/tooltip/tooltip.gif The url to the tooltip icon
tooltipDelay String 500 Tooltip shows up after the specified timeout (miliseconds). A behavior similar to that of OS based tooltips.
key simple String The name of the property this input field represents. This will auto populate the name, label, and value
tooltipConfig is deprecated, use individual tooltip configuration attributes instead Every Form UI component (in xhtml / css_xhtml or any other that extends them) can have tooltips assigned to them. The Form component's tooltip related attribute, once defined, will be applied to all form UI components that are created under it unless explicitly overriden by having the Form UI component itself defined with their own tooltip attribute.

In Example 1, the textfield will inherit the tooltipDelay and tooltipIconPath attribte from its containing form. In other words, although it doesn't define a tooltipIconPath attribute, it will have that attribute inherited from its containing form.

In Example 2, the textfield will inherite both the tooltipDelay and tooltipIconPath attribute from its containing form, but the tooltipDelay attribute is overriden at the textfield itself. Hence, the textfield actually will have its tooltipIcon defined as /myImages/myIcon.gif, inherited from its containing form, and tooltipDelay defined as 5000.

Example 3, 4 and 5 show different ways of setting the tooltip configuration attribute.
Example 3: Set tooltip config through the body of the param tag
Example 4: Set tooltip config through the value attribute of the param tag
Example 5: Set tooltip config through the tooltip attributes of the component tag



<!-- Example 1: -->
<s:form
         tooltipDelay="500"
         tooltipIconPath="/myImages/myIcon.gif" .... >
  ....
    <s:textfield label="Customer Name" tooltip="Enter the customer name" .... />
  ....
</s:form>

<!-- Example 2: -->
<s:form
         tooltipDelay="500"
         tooltipIconPath="/myImages/myIcon.gif" .... >
  ....
    <s:textfield label="Address"
         tooltip="Enter your address"
         tooltipDelay="5000" />
  ....
</s:form>


<-- Example 3: -->
<s:textfield
       label="Customer Name"
       tooltip="One of our customer Details">
       <s:param name="tooltipDelay">
            500
       </s:param>
       <s:param name="tooltipIconPath">
            /myImages/myIcon.gif
       </s:param>
</s:textfield>


<-- Example 4: -->
<s:textfield
         label="Customer Address"
         tooltip="Enter The Customer Address" >
         <s:param
             name="tooltipDelay"
             value="500" />
</s:textfield>


<-- Example 5: -->
<s:textfield
         label="Customer Telephone Number"
         tooltip="Enter customer Telephone Number"
         tooltipDelay="500"
         tooltipIconPath="/myImages/myIcon.gif" />


Field Summary
protected  HttpServletRequest request     
protected  HttpServletResponse response     
protected  String templateSuffix     
protected  String template     
protected  String templateDir     
protected  String theme     
protected  String key     
protected  String id     
protected  String cssClass     
protected  String cssStyle     
protected  String cssErrorClass     
protected  String cssErrorStyle     
protected  String disabled     
protected  String label     
protected  String labelPosition     
protected  String labelSeparator     
protected  String requiredposition     
protected  String name     
protected  String required     
protected  String tabindex     
protected  String value     
protected  String title     
protected  String onclick     
protected  String ondblclick     
protected  String onmousedown     
protected  String onmouseup     
protected  String onmouseover     
protected  String onmousemove     
protected  String onmouseout     
protected  String onfocus     
protected  String onblur     
protected  String onkeypress     
protected  String onkeydown     
protected  String onkeyup     
protected  String onselect     
protected  String onchange     
protected  String accesskey     
protected  String tooltip     
protected  String tooltipConfig     
protected  String javascriptTooltip     
protected  String tooltipDelay     
protected  String tooltipCssClass     
protected  String tooltipIconPath     
protected  Map<String, Object> dynamicAttributes     
protected  String defaultTemplateDir     
protected  String defaultUITheme     
protected  TemplateEngineManager templateEngineManager     
Fields inherited from org.apache.struts2.components.Component:
COMPONENT_STACK,  stack,  parameters,  actionMapper,  throwExceptionOnELFailure
Constructor:
 public UIBean(ValueStack stack,
    HttpServletRequest request,
    HttpServletResponse response) 
Method from org.apache.struts2.components.UIBean Summary:
addFormParameter,   buildTemplateName,   enableAncestorFormCustomOnsubmit,   end,   ensureAttributeSafelyNotEscaped,   escape,   evaluateExtraParams,   evaluateNameValue,   evaluateParams,   getDefaultTemplate,   getId,   getTemplate,   getTemplateDir,   getTheme,   getTooltipConfig,   getValueClassType,   mergeTemplate,   populateComponentHtmlId,   setAccesskey,   setCssClass,   setCssErrorClass,   setCssErrorStyle,   setCssStyle,   setDefaultTemplateDir,   setDefaultUITheme,   setDisabled,   setDynamicAttributes,   setId,   setJavascriptTooltip,   setKey,   setLabel,   setLabelSeparator,   setLabelposition,   setName,   setOnblur,   setOnchange,   setOnclick,   setOndblclick,   setOnfocus,   setOnkeydown,   setOnkeypress,   setOnkeyup,   setOnmousedown,   setOnmousemove,   setOnmouseout,   setOnmouseover,   setOnmouseup,   setOnselect,   setRequired,   setRequiredposition,   setTabindex,   setTemplate,   setTemplateDir,   setTemplateEngineManager,   setTheme,   setTitle,   setTooltip,   setTooltipConfig,   setTooltipCssClass,   setTooltipDelay,   setTooltipIconPath,   setValue
Methods from org.apache.struts2.components.Component:
addAllParameters,   addParameter,   altSyntax,   altSyntax,   completeExpressionIfAltSyntax,   copyParams,   determineActionURL,   determineNamespace,   end,   end,   fieldError,   findAncestor,   findString,   findString,   findStringIfAltSyntax,   findValue,   findValue,   findValue,   getComponentStack,   getParameters,   getStack,   popComponentStack,   setActionMapper,   setThrowExceptionsOnELFailure,   start,   stripExpressionIfAltSyntax,   stripExpressionIfAltSyntax,   toString,   usesBody
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.struts2.components.UIBean Detail:
 public  void addFormParameter(String key,
    Object value) 
 protected Template buildTemplateName(String myTemplate,
    String myDefaultTemplate) 
 protected  void enableAncestorFormCustomOnsubmit() 
 public boolean end(Writer writer,
    String body) 
 protected String ensureAttributeSafelyNotEscaped(String val) 
    Ensures an unescaped attribute value cannot be vulnerable to XSS attacks
 protected String escape(String name) 
 protected  void evaluateExtraParams() 
 protected boolean evaluateNameValue() 
 public  void evaluateParams() 
 abstract protected String getDefaultTemplate()
    A contract that requires each concrete UI Tag to specify which template should be used as a default. For example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm". This value not begin with a '/' unless you intend to make the path absolute rather than relative to the current theme.
 public String getId() 
    Get's the id for referencing element.
 public String getTemplate() 
 public String getTemplateDir() 
 public String getTheme() 
 protected Map getTooltipConfig(UIBean component) 
 protected Class getValueClassType() 
 protected  void mergeTemplate(Writer writer,
    Template template) throws Exception 
 protected  void populateComponentHtmlId(Form form) 
    Create HTML id element for the component and populate this component parmaeter map. Additionally, a parameter named escapedId is populated which contains the found id value filtered by #escape(String) , needed eg. for naming Javascript identifiers based on the id value. The order is as follows :-
    1. This component id attribute
    2. [containing_form_id]_[this_component_name]
    3. [this_component_name]
 public  void setAccesskey(String accesskey) 
 public  void setCssClass(String cssClass) 
 public  void setCssErrorClass(String cssErrorClass) 
 public  void setCssErrorStyle(String cssErrorStyle) 
 public  void setCssStyle(String cssStyle) 
 public  void setDefaultTemplateDir(String dir) 
 public  void setDefaultUITheme(String theme) 
 public  void setDisabled(String disabled) 
 public  void setDynamicAttributes(Map<String, Object> dynamicAttributes) 
 public  void setId(String id) 
 public  void setJavascriptTooltip(String javascriptTooltip) 
 public  void setKey(String key) 
 public  void setLabel(String label) 
 public  void setLabelSeparator(String labelseparator) 
 public  void setLabelposition(String labelPosition) 
 public  void setName(String name) 
 public  void setOnblur(String onblur) 
 public  void setOnchange(String onchange) 
 public  void setOnclick(String onclick) 
 public  void setOndblclick(String ondblclick) 
 public  void setOnfocus(String onfocus) 
 public  void setOnkeydown(String onkeydown) 
 public  void setOnkeypress(String onkeypress) 
 public  void setOnkeyup(String onkeyup) 
 public  void setOnmousedown(String onmousedown) 
 public  void setOnmousemove(String onmousemove) 
 public  void setOnmouseout(String onmouseout) 
 public  void setOnmouseover(String onmouseover) 
 public  void setOnmouseup(String onmouseup) 
 public  void setOnselect(String onselect) 
 public  void setRequired(String required) 
 public  void setRequiredposition(String requiredposition) 
 public  void setTabindex(String tabindex) 
 public  void setTemplate(String template) 
 public  void setTemplateDir(String templateDir) 
 public  void setTemplateEngineManager(TemplateEngineManager mgr) 
 public  void setTheme(String theme) 
 public  void setTitle(String title) 
 public  void setTooltip(String tooltip) 
 public  void setTooltipConfig(String tooltipConfig) 
 public  void setTooltipCssClass(String tooltipCssClass) 
 public  void setTooltipDelay(String tooltipDelay) 
 public  void setTooltipIconPath(String tooltipIconPath) 
 public  void setValue(String value)