Iterator - for formatting HTML Table dynamically


I’ve a requirement where I need to build a table dynamically based on an SQL query.

Yes, but the best way to do this is by building the table programmatically, using the jsf component apis (see Here are links to a few examples of building a table programmatically:

The one thing you have to do differently with caf views from the examples using jsp is that the jsp examples simply use a “binding” attribute on an h:dataTable jsp to connect the programmatically-built table to the rendered page. With caf views, you should put the table-building code in a method called “beforeRenderResponse” in your page bean, and connect it to the the view by looking up a component (such as a panel) in your view, and adding the new table as a child of that component. Here’s an example:

protected void beforeRenderResponse() {


Thanks so

Best way is to create an IPortletURL via your page bean’s createRenderUrl() method. You can use this api to add parameters. For example, the following java code would create a portlet url, set it’s base to the alias of a page containing some other portlet, and configure the “myParam” parameter of that other portlet:

IPortletURL portletUrl = createRenderUrl();
// display some other page
// configure some other portlet
IPortletURL otherPortletUrl = url.addPortletURL(“other.portlet.alias”);
// set some parameter of the other portlet
otherPortletUrl.setParameter(“myParam”, “myValue”);

// set the value of a link control to this string:
String url = portletUrl.toString();

See “” for the IPortletURL javadocs.