سؤال

I am developing a model based web application on Struts2.2.3. What I mean by model is, database tables are represented as java classes(you know). And models have properties with types such as Integer, Date and so on. When I render these values on page, and when user puts values other than it is original type, it always giving me exceptions. It is not reaching validation function before getting populated.

And it shows following message on page:

Invalid field value for field "estimates[1].count".

Also shows following exception on console

 WARN OgnlValueStack:60 - Error setting expression 'estimates[1].count' with value '[Ljava.lang.String;@a61ffd'

I saw several people had this issue before like this: http://osdir.com/ml/user-struts.apache.org/2009-12/msg00037.html

I have my ConversionError interceptor removed from my default stack. And my devMode is off. However, I am still getting these errors.

UPDATE:

I found that error exception can be caught by MyAction-validation.xml and error message can be customized. But OGNL warning still remained.

Thus the question is:

Is there any way not to show this warning on log?

هل كانت مفيدة؟

المحلول 2

If you encountered this, there is no solution not to display this WARN on console or log:

Please read:

http://www.mail-archive.com/user@struts.apache.org/msg90542.html

نصائح أخرى

The problem is that the framework is trying to convert your form data to an inadequate Java type (Generally into a String). So if your beans or actions have different types a conversion error is thrown.

I fix this by creating my own personal converters and register them in the xwork-conversion.properties file.

You should check this out: http://struts.apache.org/2.2.3/docs/type-conversion.html

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top