Trouble with setActionExpression

Hello,

I have a web application that gets all of its information from an xml file created by another application. Everything is working fine with the exception of one page which may have multiple DataTables. I am able to create the tables and add them to the page but I cannot seem to get the setActionExpression to work. I am using JSF 1.2 so 1.1 solutions will not work for me. The code I am currently trying is below:

// Inside init()

MultiValueMap map = getSessionBean1().getSeasonal();

Set keys = map.keySet();

Iterator it = keys.iterator();

while (it.hasNext()){

ArrayList linkList =new ArrayList();

Object header = it.next();

Collection collect = map.getCollection(header);

Object [] ob = collect.toArray();

for (int i = 0; i < ob.length; i++){

SeasonalHelper sh = (SeasonalHelper)ob[i];

linkList.add(sh);

}

HtmlDataTable dt =new HtmlDataTable();

DefaultTableDataModel model =new DefaultTableDataModel();

model.setWrappedData(linkList);

dt.setValue(model);

dt.setId("dataTable");

dt.setVar("currentRow");

UIOutput head =new UIOutput();

head.setId("Header1");

head.setValue(header);

UIColumn column =new UIColumn();

column.setHeader(head);

ExpressionFactory expFactory = FacesContext.getCurrentInstance().

getApplication().getExpressionFactory();

ELContext elContext = FacesContext.getCurrentInstance().getELContext();

ValueExpression ve = expFactory.createValueExpression(elContext,

"#{currentRow['name']}", String.class);

MethodExpression me = expFactory.createMethodExpression(

elContext,"#{seasonal.hyperlink_action}", String.class,

new Class[]{});

Hyperlink link =new Hyperlink();

link.setActionExpression(me);

link.setTransient(true);

link.setId("hyperlink");

link.setValueExpression("value", ve);

column.getChildren().add(link);

dt.getChildren().add(column);

form1.getChildren().add(dt);

}

// End init()

public String hyperlink_action(){return"case1";}

SeasonHelper is a class I have holding two string properties, name and url.

I have done some pretty extensive searching for the solution to this but it appears most people are still using JSF 1.1. I also haven't seen any examples of people creating dynamic tables in this way.

[3348 byte] By [rogerrhodya] at [2007-11-26 19:51:48]
# 1

I have found the solution to my own problem again through tinkering. It appears that link.setTransient(true)

was stopping the action. I didn't completely understand what it was for when I added it. I saw on another forum for adding dynamic links that it was necessary. I must have missed something they were trying to say about it.

rogerrhodya at 2007-7-9 22:42:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Setting transient to true means that the component (and it's children, if any) will not be stored in the component tree and therefore become "invisible" to the FacesServlet.
BalusCa at 2007-7-9 22:42:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...