简体   繁体   中英

showing error for struts2 select in netbeans

when I use the below code in Netbeans IDE, I'm getting error indication in Netbeans. but the code works fine. Can anyone please tell me why I'm getting error warning in Netbeans. is there any solution for this

The error warning is in list="#{'01':'Jan', '02':'Feb'}"

<s:select label="Months"
       name="months"
       headerKey="-1" headerValue="Select Month"
       list="#{'01':'Jan', '02':'Feb'}"
       value="selectedMonth"
       required="true"
/>

The error indication message is given below

Encountered ":" at line 1, column 7.
Was expecting one of:
    "}" ...
    "." ...
    "[" ...
    ">" ...
    "gt" ...
    "<" .....

Netbeans 7 uses JSP EL 2.1 which uses the # character now.

Probably the easiest solution at this time is to add the class of the map:

#@java.util.LinkedHashMap@{ "foo" : "foo value", "bar" : "bar value" } 

See the answer : Answer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM