There is a
Map<String,Map<Double,Double>> priceMatrix
I want to use it in a
<ui:repeat value="#{calcModel.priceMatrix.keySet().toArray()}" var="x">
<div style="display: inline-block; margin-right: 10px">
<h:inputText value="#{x}" />
</div>
<ui:repeat value="#{calcModel.priceMatrix.get(x).keySet().toArray()}" var="y">
<div style="display: inline-block; margin-right: 10px">
<h:inputText value="#{y}" />
</div>
<div style="display: inline-block;">
<h:inputText value="#{calcModel.priceMatrix.get(x).get(y)}" />
</div>
<br />
</ui:repeat>
</ui:repeat>
if i post the formular, i get a UpdateModelException with the Message:
value="#{calcModel.priceMatrix.get(x).get(y)}": Illegal Syntax for Set Operation
This issue is making me terrible since over 6 hours. My first idea was to provide own getter and setter in my bean. This dosn't work because jsf calls the getter before calling the setter.
Is there a solution for my problem?
Would it be better to work with List?
Thank you!
<h:inputText value="#{calcModel.priceMatrix.get(x).get(y)}" />
This is indeed not a writable value expression. This represents a read-only value expression. EL can't figure out how to invoke setters on it as the EL expression represents a chain of method calls not nested properties.
You need to replace it by a writable value expression with help of brace notation []
which represents nested properties.
<h:inputText value="#{calcModel.priceMatrix[x][y]}" />
Your other inputs also don't look good, value="#{x}"
is surely also not writable, but you'll by now able to figure out the right syntax: just use #{map[key]}
syntax instead of #{key}
.
Note that this is not specifically a JSF problem. The root cause your exception as you can find further down in stack trace is a javax.el.PropertyNotWritableException
. As its package javax.el
says, it's an EL problem, not a JSF one.