What is wrong with headerKey=“-1”?

后端 未结 1 992
-上瘾入骨i
-上瘾入骨i 2020-12-18 15:41

What is wrong with:



        
相关标签:
1条回答
  • 2020-12-18 16:37

    Nothing wrong with the key but may be a little bit with docs: -1 is an integer key, '-1' is a string, '' is an empty char, "" is an empty string, but the key should not be empty. Thus -1, '-1', ' ', " " are valid values. From the docs:

    '1' is a char, '01' is a String, "1" is a String. This is important since if the value returned by your "value" attribute is NOT the same type as the key in the "list" attribute, they WILL NOT MATCH, even though their String values may be equivalent. If they don't match, nothing in your list will be auto-selected.

    You should provide to the listKey attribute a corresponding field type, so -1 is for integer of numeric types, rather than ' ' and " " are for character and string types.

    The framework uses a type conversion when comparing keys and values of the select tag and to avoid a typecast errors occurred somewhere at the OGNL runtime you'd better provide the type correctly and two key attributes have the same type. And if the key value, which should be not empty, matches the value specified in the both attributes the header value option will be populated.

    0 讨论(0)
提交回复
热议问题