struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Toni Lyytikäinen" <tol...@gmail.com>
Subject Re: Sanitize Text
Date Thu, 23 Aug 2007 17:10:46 GMT
You could just override the string conversion in xwork:

http://struts.apache.org/2.x/docs/type-conversion.html

define something like this in xwork-conversion.properties

java.lang.String=org.example.MyConverter

Then create a class MyConverter that extends the XWorkBasicConverter and
override the behaviour of the convertValue method in the case of string to
string conversion.

I'm not sure if this is actually a good way, but it's easy enough and with
simple configuration it works everywhere in you webapp.

On 8/23/07, Ian Roughley <ian@fdar.com> wrote:
>
> This is a good approach.  In fact, you might start with the params
> interceptor - as it is responsible for assigning data to the action, and
> all that is needed is to sanitize before assignment.
>
> /Ian
>
> Richard Sayre wrote:
> > I was wondering what the best approach would be for taking form data
> > passed to an Action and removing 'special characters' from the data.
> > I am having issues with users pasting text from word docs etc.  We
> > only support ISO-8859-1 as of now and there are some characters that
> > Word will replace such as ' and " with character that are outside the
> > 8839-1 character set.
> >
> > I was thinking about an interceptor that would sanitize the request
> > parameters before they are passed to the action.  Is this a good
> > approach?  Can anyone suggest a better one?  It does not matter if it
> > uses Struts or not.
> >
> > Thank you
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message