Insert
Allows for the insertion of text (with a specified format) into the HTML response. The text itself can be filtered or not. When filtering is enabled (the default), certain characters (such as < and >) are escaped into HTML safe representations (such as < and >).
See also: org.apache.tapestry.components.Insert, Conditional, Foreach, RenderBlock, InsertText, RenderBody
Parameters
Name | Type | Direction | Required | Default Value | Default Binding | Description |
---|---|---|---|---|---|---|
value | Object | in | no | ognl | The value to be inserted. If the binding is null, then nothing is inserted. Any object may be inserted, the toString() method is used to convert it to a printable value. | |
format | Format | in | no | ognl | An optional format object used to convert the value parameter for insertion into the HTML response. | |
class | String | in | no | literal | If specified, then the output is wrapped in an HTML <span> tag,
using the value specified as the CSS class.
Informal parameters are only rendered if a class is specified. |
|
raw | boolean | in | no | false | If true, then the method
IMarkupWriter.printRaw(String) is used, rather than
IMarkupWriter.print(String).
This bypasses the normal safeguards and is used when the value to insert contains HTML markup that should be emitted as is. |
Body: removed
Informal parameters: allowed
Reserved parameters: none
Examples
Inserts the pages dueDate and applies the specified DateFormat and HTML class. Example output:
<table class="examples" cellpadding="8"> <tr> <td> The order was due on the <span class="overdue">21 January 2002</span>. </td> </tr> </table>
HTML template
<table class="examples" cellpadding="8"> <tr> <td> The order was due on the <font color="red"><b> <span jwcid="@Insert" value="date" format="@EnquiryPage@DATE_FORMAT" class="ognl:dueClass">21 January 2002</span>. </td> </tr> </table>
This will extract the date and dueClass properties from the page. It will also obtain the DATE_FORMAT public static variable, and use that to format the date before inserting it.
Java class
public abstract class EnquiryPage extends BasePage { public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd MMM yyyy"); public abstract Date getDueDate(); public abstract String getDueClass(); }