Thank you so much, I solved the special characters problems by setting the struts i18n constant to ISO-8859-1! About the conversion error, I know it was a dev mode warning, but when the exception was thrown every dynamic content in my page disappeard... Anyway I solved the issue by declaring every action attribute as a string and using specific regex xml validators to deny invalid inputs. Then, in the action, I use parser and other utility methods to convert the attributes to their correct formats.

Regards


Il 11/10/2013 07:19, Lukasz Lenart ha scritto:
Please ask such questions via User Mailing List

2013/10/10 Alessio Matteo <amat...@transtecservices.com>:
Hi,

I'm trying to develop my Struts2 application, but I'm facing 2 problems that
I can't solve:

1. I'm using xml validations for input forms, but I have a problem with
double, dates and all non string type fields (all other validations are
working fine). For example, I have a s:textfield on a jsp that is connected
to a Date type object in the relative action, if I enter a correct date
everything works fine, but if I try to input something "wrong"(a letter for
example), the framework fails to convert the string I entered and I get this
exception :
java.lang.NoSuchMethodException:
package.ActionName.setFieldName([Ljava.lang.String;)

I also tried to implement my own converter extending StrutsTypeConverter and
it seems to work, but when I throw TypeConversionException I keep on getting
the same exception.

What am I missing? I'm thinking about some interceptor problem, like
conversionError interceptor, my package extends struts-default so all
interceptors should be available, right?
Should I configure something else about interceptors?
Is it in devMode? It looks like just a warning in logs.


2. When in a s:textfield (in a generical jsp), I insert a ISO-8859-1 special
character (like à,è,ì etc..), in the relaive action, the relative field is
populated with "?" instead of special characters. I'm encoding everything in
ISO-8859-1 (form acceptcharset, head page declaration, <%@ contentype%>
etc..) but I can't find a way to convert this characters before they're
passed to the action (Maybe interceptor problems here too?).

may miss something obvious, indeed need someone to help me.
ISO-8859-1 isn't the best choice, whole Java world uses UTF-8, also
Struts2 by default encodes everything with UTF-8. So the best option
is to switch to UTF-8 or you can change struts.i18n.encoding constant
to ISO-8859-1 but thus probably won't solve all your problems.


Regards


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to