To answer this question can you reference examples 173 (page 173) and 174 in the Application Developers Guide for JSF. Please keep in mind that my application is 100% programmatic (100% java).
In example 174 this is easily represented programmatically since each Backbase tag has another Backbase tag as a parent. However in example 173 the bjsf tags have tags other than Backbase tags in it. This ability was added in 4.2.0 (I think). My question is – If I have a Backbase java object (say for UIBackbaseForm) on the server side and I want to add these tags programmatically as a child (added as a string) how can I do that? The addChild method is clearly not sufficient. Also, when added will they add the bjsf:inputText and other bjsf tags as children to the UIBackbaseForm in the server DOM?
<table>
<tr>
<td>Name:</td>
<td>
<bjsf:inputText value="#{user.name}" />
</td>
</tr>
<tr>
<td>Password:</td>
<td>
<bjsf:inputSecret value="#{user.password}" />
</td>
</tr>
</table>
<p>
<bjsf:outputText value="the MPI way" />
<bjsf:commandLink value="Login" action="#{action.doLogin}" />
</p>
<p>
<bjsf:outputText value="the MPI way" />
<bjsf:commandButton value="Login" action="#{action.doLogin}" />
</p>
<p>
<bjsf:outputText value="the SPI way" />
<bjsf:commandLink value="Login" action="#{action.doLoginView}"
destinationId="main" mode="replaceChildren" />
</p>

DeltaActionRender
23 July, 2008 - 15:07 — SenakaHi Ed,
In order to render the html tags dynamically to the
<bjsf:form/>, you can use the DeltaActionRender class. The DeltaActionRender has the same functionalty as with c:create, but in this instance we are injecting some xml into the server delta response. The DeltaActionRender requires a component as the target destination, the xml string and the mode to specify how the node will be placed in the DOM tree.The example below shows how this could be achieved. Please note that the components are not constructed dynamically for this example, however im sure you can achieve this with ease.
Index.jsp
<bjsf:form id="form001" binding="#{myBean.form001}" />
Backingbean.java
private UIBackbaseForm form001;
String renderXml = "<h3>Please enter your name and password.</h3><table><tr><td>Name:</td><td><input/></td></tr><tr><td>Password:</td><td><input/></td></tr></table>";
public MyBean() {
super();
}
public void render(ActionEvent event) {
DeltaActionRender render = new DeltaActionRender(form001, renderXml, "appendChild"); //destination, xml, mode
UIBackbaseCommandButton submitButton = new UIBackbaseCommandButton();
submitButton.setValue("Submit");
form001.addChild(submitButton);
BackbaseContext.getCurrentInstance().addDeltaAction(render);
}
public UIBackbaseForm getForm001() {
return form001;
}
public void setForm001(UIBackbaseForm form001) {
this.form001 = form001;
}
Hope this helps,
-Senaka
Hi Senaka, In the renderXML
23 July, 2008 - 19:50 — escanzanoHi Senaka,
In the renderXML string you mention can you put tags into this stream and to they get added into the server-side DOM tree?
Thanks
Ed
Hi Ed, The xml created will
24 July, 2008 - 12:02 — SenakaHi Ed,
The xml created will not get added into the server component tree. What you could do is to use UIBackbaseOutputText, set escape as false and add the html tags as the value. Since now we are creating the html tags via associated UIBackbaseOutputText components you have the flexibility to manipulated these on the server tree.
UIBackbaseCommandButton submitButton = new UIBackbaseCommandButton();
submitButton.setValue("Submit");
UIBackbaseOutputText output001 = new UIBackbaseOutputText();//an html tag or xml fragment
output001.setEscape(false);
output001.setValue(renderXml);
form001.addChild(output001);
}
Hope this helps,
-Senaka
Hi Senaka,
24 July, 2008 - 13:42 — escanzanoHi Senaka,
What if I output bjsf tags? Will they be seen by the browser engine and will they be added to the server side dom? I guess what I am getting to here is I want to dynamically created backbase widgets...so should I write b: tags into the delta action renderer?
Another question: What does the server-side dom tree look like in example 173?
Ideally, would it be possible to write store the text to a JSP page and programmatically insert that into the JSF DOM? The problem is I do not use any JSP files and need a programmatic equivalent.
Thanks
Ed