entry が myMap のエントリである次の入力タグを使用します。
<form:input path="myMap[${entry.key}].parameters[${counter}].value" />
および次のオブジェクト
Map<Long, MyViewModel> myMap;
public class MyViewModel {
private List<My2ViewModel> parameters;
...
entry.key の値が整数の場合、すべてが正常に機能します。しかし、それが長い場合 (例: 5000000000) はクラッシュします
org.springframework.expression.spel.SpelParseException: EL1035E:(pos 14): The value '5000000000' cannot be parsed as an int
at org.springframework.expression.spel.ast.Literal.getIntLiteral(Literal.java:79)
at org.springframework.expression.spel.standard.InternalSpelExpressionParser.maybeEatLiteral(InternalSpelExpressionParser.java:688)
at org.springframework.expression.spel.standard.InternalSpelExpressionParser.eatStartNode(InternalSpelExpressionParser.java:429)
at org.springframework.expression.spel.standard.InternalSpelExpressionParser.eatPrimaryExpression(InternalSpelExpressionParser.java:282)
at org.springframework.expression.spel.standard.InternalSpelExpressionParser.eatUnaryExpression(InternalSpelExpressionParser.java:275)
...
Caused by: java.lang.NumberFormatException: For input string: "5000000000"
L (スティーブンの提案) を追加すると、別のエラーが発生します。
<form:input path="myMap[${entry.key}L].parameters[${counter}].value" />
java.lang.IllegalArgumentException: The field type is required
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.webflow.mvc.view.ConvertingPropertyEditorAdapter.<init>(ConvertingPropertyEditorAdapter.java:48)
at org.springframework.webflow.mvc.view.BindingModel.findSpringConvertingPropertyEditor(BindingModel.java:277)
at org.springframework.webflow.mvc.view.BindingModel.findEditor(BindingModel.java:183)
at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:125)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:179)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:199)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:165)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:152)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:143)
at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:127)
at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:421)
at org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142)
...