org.apache.struts2.components
类 UIBean

java.lang.Object
  继承者 org.apache.struts2.components.Component
      继承者 org.apache.struts2.components.UIBean
直接已知子类:
ActionError, ActionMessage, Checkbox, ClosingUIBean, Debug, FieldError, File, GenericUIBean, Head, Hidden, Label, ListUIBean, TextArea, TextField, Token

public abstract class UIBean
extends Component

UIBean is the standard superclass of all Struts UI components. 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
themeExpansionToken n/a String special token (defined with struts.ui.theme.expansion.token) used to search for template in parent theme (don't use it separately!)
expandTheme n/a String concatenation of themeExpansionToken and theme which tells internal template loader mechanism to try load template from current theme and then from parent theme (and parent theme, and so on) when used with <#include/> directive

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
errorPosition xhtml String define error position of form element (top|bottom), default to top
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" />

 
 


字段摘要
 
从类 org.apache.struts2.components.Component 继承的字段
COMPONENT_STACK
 
构造方法摘要
UIBean(com.opensymphony.xwork2.util.ValueStack stack, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
方法摘要
 void addFormParameter(String key, Object value)
           
 void copyParams(Map params)
          Pushes this component's parameter Map as well as the component itself on to the stack and then copies the supplied parameters over.
 boolean end(Writer writer, String body)
          Callback for the end tag of this component.
 void evaluateParams()
           
 String getId()
          Get's the id for referencing element.
 String getTemplate()
           
 String getTemplateDir()
           
 String getTheme()
           
 void setAccesskey(String accesskey)
           
 void setCssClass(String cssClass)
           
 void setCssErrorClass(String cssErrorClass)
           
 void setCssErrorStyle(String cssErrorStyle)
           
 void setCssStyle(String cssStyle)
           
 void setDefaultTemplateDir(String dir)
           
 void setDefaultUITheme(String theme)
           
 void setDisabled(String disabled)
           
 void setDynamicAttributes(Map<String,Object> dynamicAttributes)
           
 void setErrorPosition(String errorPosition)
           
 void setId(String id)
           
 void setJavascriptTooltip(String javascriptTooltip)
           
 void setKey(String key)
           
 void setLabel(String label)
           
 void setLabelposition(String labelPosition)
           
 void setLabelSeparator(String labelseparator)
           
 void setName(String name)
           
 void setOnblur(String onblur)
           
 void setOnchange(String onchange)
           
 void setOnclick(String onclick)
           
 void setOndblclick(String ondblclick)
           
 void setOnfocus(String onfocus)
           
 void setOnkeydown(String onkeydown)
           
 void setOnkeypress(String onkeypress)
           
 void setOnkeyup(String onkeyup)
           
 void setOnmousedown(String onmousedown)
           
 void setOnmousemove(String onmousemove)
           
 void setOnmouseout(String onmouseout)
           
 void setOnmouseover(String onmouseover)
           
 void setOnmouseup(String onmouseup)
           
 void setOnselect(String onselect)
           
 void setRequiredLabel(String requiredLabel)
           
 void setRequiredPosition(String requiredPosition)
           
 void setTabindex(String tabindex)
           
 void setTemplate(String template)
           
 void setTemplateDir(String templateDir)
           
 void setTemplateEngineManager(TemplateEngineManager mgr)
           
 void setTheme(String theme)
           
 void setTitle(String title)
           
 void setTooltip(String tooltip)
           
 void setTooltipConfig(String tooltipConfig)
           
 void setTooltipCssClass(String tooltipCssClass)
           
 void setTooltipDelay(String tooltipDelay)
           
 void setTooltipIconPath(String tooltipIconPath)
           
 void setUIThemeExpansionToken(String uiThemeExpansionToken)
           
 void setValue(String value)
           
 
从类 org.apache.struts2.components.Component 继承的方法
addAllParameters, addParameter, altSyntax, getComponentStack, getParameters, getStack, setActionMapper, setThrowExceptionsOnELFailure, setUrlHelper, start, usesBody
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

UIBean

public UIBean(com.opensymphony.xwork2.util.ValueStack stack,
              javax.servlet.http.HttpServletRequest request,
              javax.servlet.http.HttpServletResponse response)
方法详细信息

setDefaultTemplateDir

public void setDefaultTemplateDir(String dir)

setDefaultUITheme

public void setDefaultUITheme(String theme)

setUIThemeExpansionToken

public void setUIThemeExpansionToken(String uiThemeExpansionToken)

setTemplateEngineManager

public void setTemplateEngineManager(TemplateEngineManager mgr)

end

public boolean end(Writer writer,
                   String body)
从类 Component 复制的描述
Callback for the end tag of this component. Should the body be evaluated again?

NOTE: will pop component stack.

覆盖:
Component 中的 end
参数:
writer - the output writer.
body - the rendered body.
返回:
true if the body should be evaluated again

getTemplateDir

public String getTemplateDir()

getTheme

public String getTheme()

evaluateParams

public void evaluateParams()

addFormParameter

public void addFormParameter(String key,
                             Object value)

getId

public String getId()
Get's the id for referencing element.

返回:
the id for referencing element.

setId

public void setId(String id)

setTemplateDir

public void setTemplateDir(String templateDir)

setTheme

public void setTheme(String theme)

getTemplate

public String getTemplate()

setTemplate

public void setTemplate(String template)

setCssClass

public void setCssClass(String cssClass)

setCssStyle

public void setCssStyle(String cssStyle)

setCssErrorClass

public void setCssErrorClass(String cssErrorClass)

setCssErrorStyle

public void setCssErrorStyle(String cssErrorStyle)

setTitle

public void setTitle(String title)

setDisabled

public void setDisabled(String disabled)

setLabel

public void setLabel(String label)

setLabelSeparator

public void setLabelSeparator(String labelseparator)

setLabelposition

public void setLabelposition(String labelPosition)

setRequiredPosition

public void setRequiredPosition(String requiredPosition)

setErrorPosition

public void setErrorPosition(String errorPosition)

setName

public void setName(String name)

setRequiredLabel

public void setRequiredLabel(String requiredLabel)

setTabindex

public void setTabindex(String tabindex)

setValue

public void setValue(String value)

setOnclick

public void setOnclick(String onclick)

setOndblclick

public void setOndblclick(String ondblclick)

setOnmousedown

public void setOnmousedown(String onmousedown)

setOnmouseup

public void setOnmouseup(String onmouseup)

setOnmouseover

public void setOnmouseover(String onmouseover)

setOnmousemove

public void setOnmousemove(String onmousemove)

setOnmouseout

public void setOnmouseout(String onmouseout)

setOnfocus

public void setOnfocus(String onfocus)

setOnblur

public void setOnblur(String onblur)

setOnkeypress

public void setOnkeypress(String onkeypress)

setOnkeydown

public void setOnkeydown(String onkeydown)

setOnkeyup

public void setOnkeyup(String onkeyup)

setOnselect

public void setOnselect(String onselect)

setOnchange

public void setOnchange(String onchange)

setAccesskey

public void setAccesskey(String accesskey)

setTooltip

public void setTooltip(String tooltip)

setTooltipConfig

public void setTooltipConfig(String tooltipConfig)

setKey

public void setKey(String key)

setJavascriptTooltip

public void setJavascriptTooltip(String javascriptTooltip)

setTooltipCssClass

public void setTooltipCssClass(String tooltipCssClass)

setTooltipDelay

public void setTooltipDelay(String tooltipDelay)

setTooltipIconPath

public void setTooltipIconPath(String tooltipIconPath)

setDynamicAttributes

public void setDynamicAttributes(Map<String,Object> dynamicAttributes)

copyParams

public void copyParams(Map params)
从类 Component 复制的描述
Pushes this component's parameter Map as well as the component itself on to the stack and then copies the supplied parameters over. Because the component's parameter Map is pushed before the component itself, any key-value pair that can't be assigned to componet will be set in the parameters Map.

覆盖:
Component 中的 copyParams
参数:
params - the parameters to copy.