rdblaha1 wrote:
>
> Would someone please help me in completion of binding/transferring my
> value
> from my HtmlCommandLink to be used in the backing bean?
>
OK. Here is what I found and what works. This is complete replacement code
for what I presented in the previous post. This code is simpler and easier
once I learned how to do it. I learned there is a huge difference between
the introductory JSF code in chapter 1 and the Integrating of Data Grids in
chapter 10 of JavaServerFaces In Action (Manning C 2005). Even in reading
and using these examples (the first got me facing the problem I did and the
second suggested I change my method) it still did not answer the question I
needed answered. I ended up copying from a previous Visual ICEFaces project
I had succesfully built. The final and key answer to my question I got
from a blog I found searching for 'HtmlOutputText binding'.
http://balusc.blogspot.com/2006/06/communication-in-jsf.html Passing
component attributes from JSF to backing beans Again I have implemented
all in the following replacement code.
itembean:
private String itemDataTableArray[][];
public void addItemNumbers(ValueChangeEvent changeEvent)
{
srchDesc= "";
srchItemno = (String)changeEvent.getNewValue();
itemDataTableArray = getItemsByItemno( srchItemno);
}
...
private HtmlDataTable itemDataTable = new HtmlDataTable();
public HtmlDataTable getItemDataTable() {
return itemDataTable;
}
public void setItemDataTable(HtmlDataTable hdt) {
this.itemDataTable = hdt;
}
private UIColumn column1 = new UIColumn();
public UIColumn getColumn1() {
return column1;
}
public void setColumn1(UIColumn uic) {
this.column1 = uic;
}
private UIColumn column2 = new UIColumn();
public UIColumn getColumn2() {
return column2;
}
public void setColumn2(UIColumn uic) {
this.column2 = uic;
}
This is displayed by the JSP page with the following code:
<h:dataTable id="itemDataTable" var="currentRow" styleClass="list_form"
rowClasses="odd_row, even_row" border="1" cellspacing="5"
binding="#{itembean.itemDataTable}" value="#{itembean.itemDataTableArray}">
<h:column binding="#{itembean.column1}" id="column1">
<f:facet name="header">
<h:outputText value="Item Number" />
</f:facet>
<h:commandLink action="#{itemcountbean.listSetup}">
<h:outputText id="outputText1"
binding="#{itemcountbean.itemnoHtmlOutputText}" value="#{currentRow[0]}" >
<f:attribute name="itemText" value="#{currentRow[0]}" />
</h:outputText>
</h:commandLink>
</h:column>
<h:column binding="#{itembean.column2}" id="column2">
<f:facet name="header">
<h:outputText value="Item Desc" />
</f:facet>
<h:outputText id="outputText2" value="#{currentRow[1]}" />
</h:column>
</h:dataTable>
The itemcountbean has the following coding in itemcountbean:
private String item = null;
private HtmlOutputText itemHtmlOutputText;
...
/**
* @return the itemHtmlOutputText
*/
public HtmlOutputText getItemHtmlOutputText() {
return itemHtmlOutputText;
}
/**
* @return the itemHtmlOutputText
*/
public String getItemHtmlOutputTextValue() {
return (String) itemHtmlOutputText.getAttributes().get("itemText");
}
/**
* @param itemHtmlOutputText the itemHtmlOutputText to set
*/
public void setitemHtmlOutputText(HtmlOutputText itemHtmlOutputText) {
this.itemHtmlOutputText = itemHtmlOutputText;
}
// Setup methods
public String listSetup() {
item = getItemHtmlOutputTextValue();
return "itemcount_itemlist";
}
--
View this message in context: http://old.nabble.com/JSF---Binding-Dynamically-built-HtmlPanelGrid-HtmlCommandLink-to-backing-bean.-tp26269605p26320976.html
Sent from the java.net - glassfish users mailing list archive at Nabble.com.