Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Managed Bean as parameter in Composite Component

 
andrew stollen
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way of setting a managed bean parameter in a composite component and then leaving the using classes to decide which actual managed bean to use?

something along the lines of: comp.xhtml

<cc:interface>
<cc:attribute name="price" />
<cc:param name="pageBean" value="#{superBean}" />
<cc:interface>
<cc:implementation>
<h:outputText value="#{cc.attrs.price}"/>
</cc:implementation>
And then, in the using page

<ezcomp:comp pageBean="actualBean"
price="#{actualBean.price}" >

</ezcomp:comp>
In my case ActualBean is a subtype of SuperBean.

I'm not even sure this is possible, but let's just say it would be great if someone proved me wrong.

Thank you in advance
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Andrew!

I'm not sure I follow this, but as far as I can see, there's no reason why a parameter can't be an entire bean, and not just a property. And, in fact, I think I may even have apps where I exploit that.

So try it and see!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic