I didn't explain the problem well.
So I have a jsf page (call it tabbed.jspx), that has a pannelTabbed
component in it.
Each tab contains an include that includes one of 2 sub-pages.
for example,
tab1
subpage1
tab2
subpage2
tab3
subpage1
tab4
subpage2
subpage1 expects a backing bean named bean1 and subpage2 uses a bean
named bean2.
I need to get subpage1 and subpage2 to use different instances of the
beans with the same names.
The same idea as t:aliasbean:
<tr:showDetailItem text="Tab 1" id="item1">
<t:aliasBeansScope>
<t:aliasBean alias="#{bean1}" value="#{someCustomBean1}">
<jsp:include page="subpage1.jspx" />
</t:aliasBean>
</tr:showDetailItem>
</t:aliasBeansScope>
<tr:showDetailItem text="Tab 2" id="item2">
<t:aliasBeansScope>
<t:aliasBean alias="#{bean2}" value="#{someCustomBean2}">
<jsp:include page="subpage2.jspx" />
</t:aliasBean>
</t:aliasBeansScope>
</tr:showDetailItem>
<tr:showDetailItem text="Tab 3" id="item3">
<t:aliasBeansScope>
<t:aliasBean alias="#{bean1}" value="#{someCustomBean3}">
<jsp:include page="subpage1.jspx" />
</t:aliasBean>
</t:aliasBeansScope>
</tr:showDetailItem>
<tr:showDetailItem text="Tab 4" id="item4">
<t:aliasBeansScope>
<t:aliasBean alias="#{bean2}" value="#{someCustomBean4}">
<jsp:include page="subpage2.jspx" />
</t:aliasBean>
</t:aliasBeansScope>
</tr:showDetailItem>
But since component bindings do not work well with aliasbean, is there
some other solution?
I got it to work with facelets (which are pretty slick I might add),
but I was wondering is there is some pattern that will solve this
without using facelets.
Thanks.
On Mon, May 5, 2008 at 3:22 PM, Mark Millman <[EMAIL PROTECTED]> wrote:
> Add three instances of the managed bean in your faces-config.xml file.
>
> <managed-bean>
> <managed-bean-name>managedBean1</managed-bean-name>
> <managed-bean-class>com.me.manageableBean</managed-bean-class>
> <managed-bean-scope>session</managed-bean-scope>
> </managed-bean>
> <managed-bean>
> <managed-bean-name>managedBean2</managed-bean-name>
> <managed-bean-class>com.me.manageableBean</managed-bean-class>
> <managed-bean-scope>session</managed-bean-scope>
> </managed-bean>
> <managed-bean>
> <managed-bean-name>managedBean3</managed-bean-name>
> <managed-bean-class>com.me.manageableBean</managed-bean-class>
> <managed-bean-scope>session</managed-bean-scope>
> </managed-bean>
>
>
>
> [EMAIL PROTECTED] | www.mizar.com | (360) 945-2643
>
>
>
>
> -----Original Message-----
> From: Adriano Ferraro [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 05, 2008 9:33 AM
> To: Apache Group - MyFaces
> Subject: [Trinidad] Help with Concept of One Page Using Multiple Backing
> Beans
>
> I have a problem that has proven to be a little difficult.
>
> I am interested in using the pannelTabbed component to provide views of
> forms.
> Also, I would like the forms to use the same "named" backing bean, but have
> the
> instance of that backing bean be different based on the tab selection.
>
> For example, tab1 corresponds to #{managedBean1},
> tab2 corresponds to #{managedBean2},
> tab3 corresponds to #{managedBean3}
>
> managedBean1 and managedBean3 extend Class BackingBeanA
> managedBean2 extends extends Class BackingBeanB
>
> ViewA.jspx relies on an instance of BackingBeanA
> ViewB.jspx relies on an instance of BackingBeanB
>
>
> tabbed.jspx
> <tr:panelTabbed id="panelTabbed1">
> <tr:showDetailItem text="Tab 1" id="item1">
> <f:subview id="v1">
> <jsp:include page="/viewA.jspx" flush="true"/>
> </f:subview>
> </tr:showDetailItem>
> <tr:showDetailItem text="Tab 2" id="item2">
> <f:subview id="v2">
> <jsp:include page="/viewB.jspx" flush="true"/>
> </f:subview>
> </tr:showDetailItem>
> <tr:showDetailItem text="Tab 3" id="item3">
> <f:subview id="v3">
> <jsp:include page="/viewA.jspx" flush="true"/>
> </f:subview>
> </tr:showDetailItem>
> </tr:panelTabbed>
>
> viewA.jspx
> <?xml version='1.0' encoding='windows-1252'?>
> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
> version="2.0"
> xmlns:tr="http://myfaces.apache.org/trinidad"
> xmlns:f="http://java.sun.com/jsf/core">
>
> <tr:outputText value="#{someNamedBeanA.name}"
> binding="#{someNamedBeanA.outputText1}"/>
> <tr:outputText value="#{someNamedBeanA.nestedObjectA.dto.name}"
> binding="#
> {someNamedBeanA.nestedObjectA.outputText1}"/>
> </jsp:root>
>
> viewB.jspx
> <?xml version='1.0' encoding='windows-1252'?>
> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
> version="2.0"
> xmlns:tr="http://myfaces.apache.org/trinidad"
> xmlns:f="http://java.sun.com/jsf/core">
>
> <tr:outputText value="#{someNamedBeanB.nestedObjectB.dto.otherName}"
> binding="#
> {someNamedBeanB.nestedObjectB.outputText1}"/>
> </jsp:root>
>
>
> I have tried the aliasBean from tomahawk, with the "hack" to get
> bindings to work, but the value binding
> someNamedBeanX.nestedObjectX.dto.name fails. I have tried facelets,
> and it seems to work for the most part.
> However, I discovered a bug in treeTable while using facelets: Setting
> the rowsByDepth property causes a
> ClassCastException. This sent a bad vibe my way, since we're working
> in a pretty serious production environment,
> and cannot afford "little" anomalies.
>
>
> Any help or ideas are much appreciated.
>
> Age
>
>