开发者

Turn off the SelectOneMenu internal validation

开发者 https://www.devze.com 2023-02-05 17:19 出处:网络
I have a Select开发者_JAVA百科OneMenu driven by a List, each of which contains an object value and a string label, along with a converter. All fairly standard. I initially got the Validation Error: Va

I have a Select开发者_JAVA百科OneMenu driven by a List, each of which contains an object value and a string label, along with a converter. All fairly standard. I initially got the Validation Error: Value is not valid error because of a typo in the equals method, but a quick search on how to fix that brings up another question:

Am I right in my understanding that, in this scenario, what happens is:

  1. An item is selected in the menu.
  2. This sends a string value to the server.
  3. The converter is used to convert the string value to an object.
  4. JSF checks that the object exists in the list of items.
  5. The setter method is called passing the object.

If so, then can I disable step 4? My converter will throw a ConverterException if the value is not valid, so for me this second list traversal is completely unnecessary.

Cheers,

Barney


This is by design. It's one of the standard website attack preventions. You can't turn it off.

Just put the bean in view scope (so that it won't be refetched on every request, for the case that), or look for a less secure MVC framework if it bothers you.

0

精彩评论

暂无评论...
验证码 换一张
取 消