2

我传递给速度模板逗号分隔值,并在开始时收到 ParseErrorException。如何解决?

#set ($test=StringUtils.split($filterFieldCSV,","))

    #foreach ( $filterField in $test )
    <!-- process something here -->
#end



Caused by: org.apache.velocity.exception.ParseErrorException: Encountered "StringUtils" at t-50[line 3, column 12] Was expecting one of:
    "[" ...
    "{" ...
    "(" ...
    <WHITESPACE> ...
    <STRING_LITERAL> ...
    "true" ...
    "false" ...
    <INTEGER_LITERAL> ...
    <FLOATING_POINT_LITERAL> ...
    <IDENTIFIER> ...
    "{" ...
    <LOGICAL_NOT> ...
        at org.apache.velocity.Template.process(Template.java:141)  at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:446)  at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354)   at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1400)   at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1380)   at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:401)
4

1 回答 1

0

我只需要有以下声明:

#set($test=$filterFieldCSV.split(","))

代替:

#set($test=StringUtils.split($filterFieldCSV,","))
于 2011-02-13T18:17:20.123 回答