|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.struts2.components.Component
org.apache.struts2.components.Text
public class Text
Render a I18n text message.
The message must be in a resource bundle with the same name as the action that it is associated with. In practice this means that you should create a properties file in the same package as your Java class with the same name as your class, but with .properties extension. If the named message is not found, then the body of the tag will be used as default message. If no body is used, then the name of the message will be used.Accessing messages from a given bundle (the i18n Shop example bundle in the first example) and using bundle defined through the framework in the second example.
<!-- First Example --> <s:i18n name="struts.action.test.i18n.Shop"> <s:text name="main.title"/> </s:i18n> <!-- Second Example --> <s:text name="main.title" /> <!-- Third Examlpe --> <s:text name="i18n.label.greetings"> <s:param >Mr Smith</s:param> </s:text>
<-- Fourth Example --> <s:text name="some.key" /> <-- Fifth Example --> <s:text name="some.invalid.key" > The Default Message That Will Be Displayed </s:text>
Param
Field Summary | |
---|---|
protected java.lang.String |
actualName
|
protected java.lang.String |
name
|
protected java.util.List |
values
|
Fields inherited from class org.apache.struts2.components.Component |
---|
COMPONENT_STACK, id, parameters, stack |
Constructor Summary | |
---|---|
Text(com.opensymphony.xwork2.util.OgnlValueStack stack)
|
Method Summary | |
---|---|
void |
addParameter(java.lang.Object value)
Adds the given value as a parameter to the outer tag. |
void |
addParameter(java.lang.String key,
java.lang.Object value)
Add's the given key and value to this components own parameter. |
boolean |
end(java.io.Writer writer,
java.lang.String body)
Callback for the end tag of this component. |
void |
setName(java.lang.String name)
Name of resource property to fetch |
boolean |
usesBody()
Overwrite to set if body shold be used. |
Methods inherited from class org.apache.struts2.components.Component |
---|
addAllParameters, altSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findValue, findValue, findValue, getComponentStack, getId, getParameters, getStack, popComponentStack, setId, start, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.List values
protected java.lang.String actualName
protected java.lang.String name
Constructor Detail |
---|
public Text(com.opensymphony.xwork2.util.OgnlValueStack stack)
Method Detail |
---|
public void setName(java.lang.String name)
public boolean usesBody()
Component
usesBody
in class Component
public boolean end(java.io.Writer writer, java.lang.String body)
Component
end
in class Component
writer
- the output writer.body
- the rendered body.
public void addParameter(java.lang.String key, java.lang.Object value)
Component
addParameter
in class Component
key
- the key of the new parameter to add.value
- the value assoicated with the key.public void addParameter(java.lang.Object value)
Param.UnnamedParametric
addParameter
in interface Param.UnnamedParametric
value
- the value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |