我想在jsp方面做这样的事情:
<c:forEach items="${configForm.unselectedServers}" var="item">
String name = "";
<c:forEach items="$item.configs" var="conf">
name += ", " + {$conf.name}
....
有可能做这样的事情吗?
item.configs
它是一个类的数组(包含name
)。我知道它有效的那部分,我只是想知道如何将这些值放入字符串中。
编辑:
我收到以下错误:
Caused by: java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Long.parseLong(Long.java:431)
at java.lang.Long.<init>(Long.java:678)
at org.apache.el.lang.ELArithmetic$LongDelegate.coerce(ELArithmetic.java:186)
at org.apache.el.lang.ELArithmetic.coerce(ELArithmetic.java:357)
at org.apache.el.lang.ELArithmetic.add(ELArithmetic.java:235)
at org.apache.el.parser.AstPlus.getValue(AstPlus.java:40)
at org.apache.el.parser.AstPlus.getValue(AstPlus.java:38)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:935)
at org.apache.jsp.config.configDetail_jsp._jspx_meth_c_005fset_005f5(configDetail_jsp.java:509)
at org.apache.jsp.config.configDetail_jsp._jspx_meth_c_005fforEach_005f1(configDetail_jsp.java:475)
at org.apache.jsp.config.configDetail_jsp._jspx_meth_c_005fforEach_005f0(configDetail_jsp.java:407)
at org.apache.jsp.config.configDetail_jsp.access$4(configDetail_jsp.java:384)
at org.apache.jsp.config.configDetail_jsp$Helper.invoke1(configDetail_jsp.java:615)
at org.apache.jsp.config.configDetail_jsp$Helper.invoke(configDetail_jsp.java:679)