ActionLink Component Index Block

Any
org.apache.tapestry.components.Any
Visual / Non Visual Component
 
Description
A component that can substitute for any HTML or XML element. Informal parameters are used to fill in the attributes of the element.
See Also
Insert, Hidden
Parameters
Name Type Direction Required Default Description
element String in yes   The element to be produced.

Body: rendered
Informal parameters: allowed
Reserved parameters: none

Examples

In this example the Any component is use to generate XML order list document.

<?xml version="1.0" encoding="ISO-8859-1" ?>
<order-list>
 <order-item id="91307" order-id="2137" cust-id="94" order-date="2002-04-13" desc="AWB-TS 4.5mm"/>
 <order-item id="91308" order-id="2137" cust-id="94" order-date="2002-04-13" desc="TGM-M2 30mm"/>
 <order-item id="92571" order-id="3846" cust-id="94" order-date="2002-05-09" desc="AWB-TS 4.5mm"/>
 <order-item id="92572" order-id="3846" cust-id="94" order-date="2002-05-09" desc="P6-AA Series 2"/>
 <order-item id="92573" order-id="3846" cust-id="94" order-date="2002-05-09" desc="AWB-TS 10mm"/>
</order-list>

<?xml version="1.0" encoding="ISO-8859-1" ?> 
<order-list>
 <span jwcid="@Foreach" source="ognl:orderItemList" value="ognl:orderItem">
  <span jwcid="orderItem" element="order-item"> 
 </span>
</order-list>


<component id="orderItem" type="Any">
    <binding name="id" expression="orderItem.id"/>
    <binding name="order-id" expression="orderItem.orderId"/>
    <binding name="cust-id" expression="orderItem.customerId"/>
    <binding name="order-date" expression="orderItem.orderDate"/>
    <binding name="desc" expression="orderItem.description"/>
</component>


public class OrderItemsXML extends BasePage {
    private List orderItemList;
    
    public List getOrderItemList() { return orderItemList; } 

    public OrderItem getOrderItem() { return orderItem; }

    public void setOrderItem(OrderItem value) {
        orderItem = value;        
    }

    public void detach() {
        orderItemList = null;
        orderItem = null;
        super.detach();
    }
}

public class OrderItem {
    private static final SimpleDateFormat DATE_FORMAT =
        new SimpleDateFormat("yyyy-MM-dd");
    private Integer id;
    private Integer orderId;
    private Integer customerId;
    private Date orderDate;
    private String description;

    public OrderItem(Integer id, Integer orderId, Integer customerId, 
            Date orderdDate, String description) {
        this.id = id;
        this.orderId = orderId;
        this.customerId = customerId;
        this.orderDate = orderDate;
        this.description = description;
    }

    public Integer getId() { return id; }
    
    public Integer getOrderId() { return orderId; }
    
    public Integer getCustomerId() { return customerId; }

    public String getOrderDate() { return DATE_FORMAT.format(orderDate); }                               

    public String getDescription() { return description; }
}

ActionLink Component Index Block