Netbeans 7.0 shows an error in the Struts2 tag. netbeans version 6.9 does not show this error

<s:select name="PenaltyPercentage" id="PenaltyPercentageId" list="#{'7.5%':'7.5%', '15.0%':'15.0%'}" <!-- shows error in this line --> headerKey="" headerValue="Please Select" emptyOption="false"> </s:select> 

error messages are read below

 Encountered ":" at line 1, column 9. Was expecting one of: "}" ... "." ... "]" ... ">" ... "<" ... 
+6
source share
1 answer

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

For me (Netbeans IDE 7.0 RC1) it compiles fine and works, although the line is flagged with an error. If Glassfish does not execute jsp, then the following link shows how to disable JSP EL in the JSP 2.1 container (at the bottom of the following link).

http://struts.apache.org/2.0.14/docs/ognl.html

Probably the easiest solution at the moment is to add a map class:

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

Found in this thread: http://struts.1045723.n5.nabble.com/s2-JSF-JSP-EL-vs-OGNL-EL-td3528303.html

Information on JSP EL 2.1 See: http://jcp.org/aboutJava/communityprocess/final/jsr245/index.html


You are probably just demonstrating this problem, but just make sure that if you provide a list, not a map, then the value returned to the server will be the same as the displayed value. Thus, the following produces the same selection field and does not cause an error:

 <s:select list="{'7.5%','15.0%'}" <!-- does not show error --> headerValue="Please Select" emptyOption="false"> </s:select> 

I took a little time to find out if I can successfully change the JSP EL version in Netbeans 7, and also tried to find a way to disable JSP EL error checking without success. Therefore, if you must use OGNL cards in your JSP, disable the EL JSP (which is not an attractive option for some) or explicitly declare the card as shown.

+6
source

Source: https://habr.com/ru/post/887637/


All Articles