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 &lt; and &gt;).

See also: org.apache.tapestry.components.Insert RenderBlock , InsertText , RenderBody

Parameters

Name Type Required Default Value Description
value Object no 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 no An optional format object used to convert the value parameter for insertion into the HTML response.
class String no 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 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:

Insert Screen Shot

HTML template

<table class="examples" cellpadding="8">
<tr>
 <td>
 The order was due on the <font color="red"><b>
 <span jwcid="@Insert" value="ognl:date" format="ognl:dateFormat" 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 dateFormat property (which is lazily instantiated), and use that to format the date before inserting it.

Java class

public abstract class EnquiryPage extends BasePage 
{
  private Format _dateFormat;

  public Format getDateFormat()
  {
    if (_dateFormat == null)
      _dateFormat = new SimpleDateFormat("dd MMM yyyy");
      
    return _dateFormat;
  }

  public abstract Date getDueDate();

  public abstract String getDueClass();
}