I think that what Torin was really asking was how to make <managedBeanName> reference different objects depending on what "parent" page included this one.

When using JSP, the tomahawk t:aliasBean tag is the best way to do this:

page1:
  <t:aliasBean value="#{realBean1}" alias="#{dst}">
    <jsp:include ..../>
  </t:aliasBean>

page2:
  <t:aliasBean value="#{realBean2}" alias="#{dst}">
    <jsp:include ..../>
  </t:aliasBean>

The included page can then reference #{dst}. The effect is pretty much like a method parameter.

Regards,

Simon

sushma sharma wrote:
  you can do this

<h:graphicImage id="image" url="#{requestScope[<managedBeanName>].image}" />


On Thu, 05 Apr 2007 Torin Chichirico wrote :
 >I'm still kind of new to JSF, so this may be more of a general JSF
 >question, but I'm wondering if there's any way in JSF or MyFaces to do
 >the following:
 >
 >I have a JSF page that I want to include in multiple other JSF pages and
 >I need to pass a value containing the name of a managed bean from the
 >parent page to the included JSF page.  Then in the included page I want
 >to use the value managed bean name variable in JSF expressions.  So the
 >included JSF page would look something like this...
 >
 >
 ><% String managedBeanName =
 >(String)request.getAttribute("managedBeanName");%>
 >
 >....
 >
 ><h:graphicImage id="image" url="#{<managedBeanName>.image}" />
 >
 >
 >
 >Is there a way to substitute my variable in the JSF expression and have
 >it call the method on the correct bean?  Or is there a better way to do
 >what I'm trying to do here?  Unfortunately we're still using JSP as our
 >view.... haven't converted to facelets yet.  Any help is appreciated.
 >Thanks,
 >
 >- Torin

Reply via email to