2010-08-31 85 views

回答

2

應該很容易。 JSP允許您使用dynamic attributes定義一個標籤,這意味着屬性作爲通用名稱/值對傳遞給自定義標籤對象,而不是像通常標籤屬性那樣通過設置器傳遞。這意味着您可以透明地支持任意HTML屬性,而無需在您的標記類中單獨聲明它們。

因此,write a subclass of SimpleTagSupport,與您的custom attributes fully defined and implemented,然後enable dynamic attributes for that tag

您仍然可以從標記代碼生成實際的HTML,但這應該很簡單。