Is this a legal construct?
transient private Map<Account,UIData> chargeUIDataComponentByAccountMap
= new HashMap<Account,UIData>();
public Map<Account, UIData> getChargeUIDataComponentByAccountMap() {
return chargeUIDataComponentByAccountMap;
}
public void setChargeUIDataComponentByAccountMap(
Map<Account, UIData> chargeUIDataComponentByAccountMap)
{
this.chargeUIDataComponentByAccountMap =
chargeUIDataComponentByAccountMap;
}
I have other transient bindings defined that do not bind to a map
which work fine each request.
transient private UIData accountUIDataComponent;
I also have another map with the same key which works fine which is
page-scoped using t:saveState, so I know the syntax works.
private Map<Account,List<ChargeItem>> chargeItemListByAccountMap = null;
The question is whether it's possible to bind a component to the page
into a request-scoped map, so long as the map exists each request?
The getter for the map returns an empty map each time. I would expect
this map to be populated as the page is constructed. The key for the
map is also valid.
One last thing which doesn't seem likely to be relevant is that the
component being bound is itself inside of a t"dataTable detailStamp
facet, but I don't think this should matter.
Below is the relevent part of the error message returned. Myfaces
Core 1.1.7, Tomahawk 1.1.9, facelets 1.1.11 (also tried 1.1.15a).
I don't seem to have the el-api or el-ri source around any more,
though, so I can't easily debug this. Anyone know where I can get a
copy of the el source for the el 1.0 jars which were originally
distributed with Facelets? The one targeted for Java 1.4.2?
MyApp ERROR [btpool0-3 09-02 15:21:28] ApplicationImpl: Exception
while creating component of type [org.apache.myfaces.HtmlDataTable]
for binding [#{page.chargeUIDataComponentByAccountMap[account]}]
Sep 2, 2009 3:21:31 PM com.sun.facelets.FaceletViewHandler handleRenderException
SEVERE: Error Rendering View[/pages/paySimple.xhtml]
javax.faces.el.PropertyNotFoundException: /pages/paySimple.xhtml
@186,28 binding="#{page.chargeUIDataComponentByAccountMap[account]}":
Target Unreachable, 'BracketSuffix' returned null
at
com.sun.facelets.el.LegacyValueBinding.setValue(LegacyValueBinding.java:72)
at
org.apache.myfaces.application.ApplicationImpl.createComponent(ApplicationImpl.java:447)
at
com.sun.facelets.tag.jsf.ComponentHandler.createComponent(ComponentHandler.java:218)
at
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:135)
at
com.sun.facelets.tag.jsf.core.FacetHandler.apply(FacetHandler.java:68)
[and so on....]
Also, I figured out a temporary workaround where I created some
transient attributes on my page bean and manually set them using
f:setPropertyActionListener in every commandButton/commandLink instead
of retrieving the values from my bound components. I may decide to go
with this instead anyway, but it'd still be good to know why the above
is non-functional.
<f:setPropertyActionListener
target="#{page.currentChargeItem}"
value="#{chargeItem}" />
<f:setPropertyActionListener
target="#{page.currentAccount}"
value="#{account}" />
Regards,
Mike