Iterator - for formatting HTML Table dynamically

Hi

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 http://java.sun.com/javaee/javaserverfaces/1.1/docs/API/overview-summary.html). Here are links to a few examples of building a table programmatically:

http://www.icefaces.org/JForum/posts/list/2955.page
http://www.manning-sandbox.com/message.jspa?messageID=41514
http://forum.java.sun.com/thread.jspa?threadID=5238214&messageID=9978386

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() {

Justin,

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
portletUrl.setBaseURL(“/my.page.alias”);
// 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 “http://www.ajax-softwareag.com/articles/Y4LCDN/Caf-7-1-1JavaDocs/com/webMethods/caf/portlet/IPortletURL.html” for the IPortletURL javadocs.

Justin