Hi Peter,
the bindig must be a valueBinding not a methodBinding!
e.g. with
<tc:panel id="content" binding="#{myBean.contentPanel}">
<%-- content filled by application --%>
</tc:panel>
your bean should provide a method
public UIPanel getContentPanel() {
if (contentPanel == null) {
createPanel();
}
return contentPanel
}
and in createPanel() you should create the content subtree:
public void createPanel() {
// create the panel
contentPanel = new UIPanel();
contentPanel.setId("contentPanel");
// IMPORTANT set a unique id to each code created UIComponent
contentPanel.setRendererType(TobagoConstants.RENDERER_TYPE_PANEL);
// create panel content
UIOutput text = new UIOutput();
text.setId("text");
text.setRendererType(TobagoConstants.RENDERER_TYPE_OUT);
text.setValue("some text value here");
// add content to panel
contentPanel.getChildren().add(text);
}
Regards
Volker
2006/9/25, Peter Rabing <[EMAIL PROTECTED]>:
Hi Volker,
thanks for your hint. I think I get the idea. From within the jsp page you call
some function which then uses the tobago class implementing the tag library
directly. This way nothing needs to be compiled.
I tried to follow your directions but I still fail to get the link from the jsp
to the controller code. I am using something like:
<tc:panel id="content" binding="#{myBean.generateComponentTree}">
<%-- content filled by application --%>
</tc:panel>
In the hope to receive a call into myBean and a matching method. However, I
only get exceptions like:
javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
org.apache.myfaces.tobago.webapp.TobagoMultipartFormdataFilter.doFilter(TobagoMultipartFormdataFilter.java:70)
org.apache.myfaces.tobago.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:149)
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:367)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
org.apache.myfaces.tobago.webapp.TobagoMultipartFormdataFilter.doFilter(TobagoMultipartFormdataFilter.java:70)
Could you shed some light on this link, or maybe point me to some documentation
or an example?
Am I supposed to write a complete Tag like the InExtension tag myself, and
place this in the panel ??
Thanks for any ideas,
Peter
> 22.09.2006 11:11
> Bitte antworten an "MyFaces Discussion"
>
> An: "MyFaces Discussion" <[email protected]>
> Thema: Re: Using Tobago dynamically from servlet ??
>
>
>
>Hi Peter,
>
>please still comunicate over the list.
>
>You can create the component tree programatically in your java code.
>
>In my example our application should create the UIPanel and content
>dynamically in invokeApplicationPhase.
>
>I currently don't know links to examples or howtos, and no time to search.
>
>But you ma took a look at the tobago tx tag classes e.g.
>
>org.apache.myfaces.tobago.taglib.extension.InExtensionTag source
>
>the <tx:... tags are UIPanels with java generated content.
>
>Regards
> Volekr
>
>
>
>> Hi Volker,
>>
>> I am a little unsure of your answer. The body of the content Panel,
>> is a method call executed at run-time. The result must be some
HTML/JavaScript code inserted into the page, correct ?
>> But rather then generate HTML, I'd prefer to generate Tobago components, to
be within the same paradigm. But these would need to be compiled ... ?
>>
>> Or is there another way to generate the component tree ?
>>
>> Thanks,
>>
>> Peter
>>
>>
>>
>> >Hi Peter,
>> >
>> >you don't need to generate a jsp, you just need to create the
>> >component tree and map it
>> >via binding into a skeleton jsp.
>> >
>> >e.g.:
>> >
>> ><tc:page>
>> > <f:facet name="layout">
>> > <tc:gridlayout columns="200px;1*"/>
>> > </f:facet>
>> >
>> > <tc:panel id="navi">
>> > <%-- left side navagation --%>
>> > <tc:panel>
>> >
>> >
>> > <tc:panel id="content" binging="#{controller.contentPanel}">
>> > <%-- content filled by application --%>
>> > <tc:panel>
>> >
>> ></tc:page>
>> >
>> >
>> >with this your application has full control over the contentPanels content.
>> >
>> >Regards
>> > Volker
>> >
>> >
>> >> Hi,
>> >>
>> >> I'd like to create a web page whose structure and layout is determined by
my back-end db. I.e. the layout and structure is highly dynamic in response to user input
and the state of the back-end. Imagine a workflow machine whose masks can be defined by an
administrator and whose steps are determined by a rule engine.
>> >>
>> >> I still would like to use the benefits of Tobago such as
internationalization, java script handling etc.
>> >>
>> >> I thought about generating a jsp and compile it on the fly, though my
guess is that this doesn't give me a very good performance ...
>> >>
>> >> Do you have any other ideas ??
>> >>
>> >> Thanks,
>> >>
>> >> Peter
>> >> --
--
NEU: GMX DSL Sofort-Start-Set - blitzschnell ins Internet!
Echte DSL-Flatrate ab 0,- Euro* http://www.gmx.net/de/go/dsl