2

I have a checkbox in my vm file like this :

<input name="ISPOperatorList[0].ISPOperatorAccessStatus" id="OPERATORAccessDeny0"
                    #if( $!serviceProviderBean.ISPOperatorList[0].ISPOperatorAccessStatus == "no") checked="checked" #end
                    class="checkBoxRadio"  type="checkbox" value="no" />

I have added the #if condition to check whether a predefined "no" value comes from back-end or not. If it comes, I will make the checkbox checked.

I am getting this error while loading the page now :

org.apache.velocity.exception.ParseErrorException: Encountered "[" at admin/ispEnrollmentPage.vm[line 203, column 91]Was expecting one of:
<RPAREN> ...
<WHITESPACE> ...
"-" ...
"+" ...
"*" ...
"/" ...
"%" ...
<LOGICAL_AND> ...
<LOGICAL_OR> ...
<LOGICAL_LT> ...
<LOGICAL_LE> ...
<LOGICAL_GT> ...
<LOGICAL_GE> ...
<LOGICAL_EQUALS> ...
<LOGICAL_NOT_EQUALS> ...
buggy
  • 45
  • 1
  • 7
  • I think the `$` and `!` are the wrong way round in `$!serviceProviderBean` i.e. it should be `#if (!$serviceProviderBean...` – mikej Mar 26 '12 at 14:00
  • Looks like you might be using a version of Velocity that doesn't support the [] syntax. – Nathan Bubna Mar 26 '12 at 15:42
  • I think Velocity generall does not support array-indices, see a similar question in a previous question at http://stackoverflow.com/questions/8751387/ – centic Mar 26 '12 at 18:54
  • I heve got the answer now ! thanks everyone for your suggestions :) – buggy Mar 26 '12 at 20:37

1 Answers1

2

I also faced a similar problem like this. Only solution is to use get(index) instead of [index]

<input name="ISPOperatorList[0].ISPOperatorAccessStatus" id="OPERATORAccessDeny0"
                #if( $!serviceProviderBean.ISPOperatorList.get(0).ISPOperatorAccessStatus == "no") checked="checked" #end
                class="checkBoxRadio"  type="checkbox" value="no" />
tusar
  • 3,364
  • 6
  • 37
  • 60