aspose file tools*
The moose likes JSF and the fly likes Dynamic data on page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Dynamic data on page" Watch "Dynamic data on page" New topic
Author

Dynamic data on page

darryl nortje
Greenhorn

Joined: Mar 31, 2004
Posts: 5
Hi there guys,

This topic heading looks just like others in this forum, I've read them and implmented the proposed solutions but something is still not working.

Here's what I have.

jsf page.....
...
<h:panelGroup id="parameterPanel" binding="#{reportBean.parameterPanel}"/>
...
<h:commandButton value="Request Report" id="requestReportButton" action="#{reportBean.requestReport}"/>
...

backing bean
...
public UIPanel getParameterPanel() {
return parameterPanel;
}
public void setParameterPanel(UIPanel parameterPanel) {
this.parameterPanel = parameterPanel;
}
...
private void loadParameters() {
HtmlOutputText table = new HtmlOutputText();
table.setValue("<table>");
table.setEscape(false);
parameterPanel.getChildren().add(table);

for (Parameter parameter : parameters) {
if (!parameter.isVisible()) {
continue;
}

table = new HtmlOutputText();
table.setValue("<tr><td valign='top'>");
table.setEscape(false);
parameterPanel.getChildren().add(table);

// add the label/////////////////////////////
HtmlOutputText label = new HtmlOutputText();
label.setValue(parameter.getLabel() + (parameter.isRequired() ? " * " : ""));
parameterPanel.getChildren().add(label);

table = new HtmlOutputText();
table.setValue("</td><td>  </td><td valign='top'>");
table.setEscape(false);
parameterPanel.getChildren().add(table);

// add the parameter control/////////////////////////////
parameterPanel.getChildren().add(parameter.getControl());

table = new HtmlOutputText();
table.setValue("</td><td>  </td><td valign='top'>");
table.setEscape(false);
parameterPanel.getChildren().add(table);

// add the blurp/////////////////////////////
HtmlOutputText blurp = new HtmlOutputText();
blurp.setValue(parameter.getBlurp());
blurp.setStyle("font-size:small;font-style:italic");
parameterPanel.getChildren().add(blurp);

table = new HtmlOutputText();
table.setValue("</td></tr>");
table.setEscape(false);
parameterPanel.getChildren().add(table);
}

table = new HtmlOutputText();
table.setValue("</table>");
table.setEscape(false);
parameterPanel.getChildren().add(table);

}

All the get control does is check the parameter attributes and decide whether to make the type an html input, radio button drop down box etc...

All works well when loading the page, but after I have filled values in to the input fields the setter for the panel never gets called.

When I click on the requestReport button the framework doesn't ever call the setParameterPanel method.

Like the binding isn't working after the first time.

Please help, let me know if you need any more info.

thanks
Darryl
darryl nortje
Greenhorn

Joined: Mar 31, 2004
Posts: 5
I solved this.

The problem was that the
<h:panelGroup id="parameterPanel" binding="#{reportBean.parameterPanel}"/>

was inside a <f:verbatim tag. This meant that the binding went for a ball.

sorry if I wasted someone's time by not posting the full source code. I did leave out the <f:verbatim tag in my original post.

Anyway. Don't put any elements you want to have bound to the backing bean inside a verbatim tag.

cheers
Darryl
David González
Greenhorn

Joined: Jun 26, 2009
Posts: 4
Hi,


One you have created the table in the backing bean, supose you want to access the values of the table iterating over the table.

How will this be done??

thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamic data on page