Injection From Pages.xml (Seam)
Does anyone know if I can inject value from pages.xml into a Seam component? In pages.xml there seems to be an in element that would indicate I can but I can't figure out how to use it & documentation is lacking.
I'm trying to set a value in a component that varies from page to page. It needs to be set for page load & I don't want it exposed to the user. Here's what I've tried at the moment:
<page view-id="/daily.xhtml">
<in name="chartLoader.reportType" value="DAILY"/>
<action开发者_运维百科 execute="#{chartLoader.loadData}" />
</page>
<page view-id="/hourly.xhtml">
<in name="#{chartLoader.reportType}" value="HOURLY"/>
<action execute="#{chartLoader.loadData}" />
</page>
Neither of these work now with an error of:
javax.el.PropertyNotWritableException: Illegal Syntax for Set Operation
The reportType property is private but it has the correct public setter method. So I'm thinking that my syntax is slightly off.
Does anyone know how to use this element correctly or have a better suggestion?
Thanks, Lee
Try this instead
<action execute="#{chartLoader.setReportType('DAILY')}"/>
精彩评论