Hi,
I'm trying to narrow down the issue, but another problem prevents that.
My page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml" xmlns:h="
http://java.sun.com/jsf/html" xmlns:ui="
http://java.sun.com/jsf/facelets">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>title</title>
</h:head>
<h:body>
<h:form id="form">
<h:panelGrid id="pn">
#{testBean.greeting}
</h:panelGrid>
</h:form>
</h:body>
</html>
My bean:
@ManagedBean
@RequestScoped
public class TestBean {
private String greeting = "hello";
public String doAction() {
System.out.println("Action");
return null;
}
@PostConstruct
public void init() {
UIComponent pn = FacesContext.getCurrentInstance().getViewRoot().findComponent("form:pn");
HtmlCommandButton btTest = new HtmlCommandButton();
btTest.setId("id");
btTest.setActionExpression(JSFUtils.createMethodExpression("#{testBean.doAction}", String.class));
btTest.setValue("Add");
pn.getChildren().add(btTest);
}
public String getGreeting() {
return this.greeting;
}
}
When i give an explicit id to the button, i get dupliate id error message on pushing the button. When i give no explicit id, the button appers twice on the page.
[Message sent by forum member 'gabox01' (gabox01)]
http://forums.java.net/jive/thread.jspa?messageID=354648