Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic data on page

 
darryl nortje
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic