You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ol...@pharma.novartis.com on 2002/10/31 19:08:59 UTC

bean:write filtering and newlines

hi,

the problem is mentioned here
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=struts-user@jakarta.apache.org&msgId=366811
to which I don't see a clean solution.

eg., imagine a form bean was populated with data from html:textareas. This
data is later presented in read-only mode on another page using
<bean:write>. Filtering does only half the job: e.g. '<' are substituted
with '&lt;', but linebreaks are not substituted with <br/>. Somebody might
also want to keep consecutive spaces by substituting them with &nbsp;,
although I find this unneccessary.

htmlifying all the strings manually before storing them in the database is
not an option because this means they cannot be updated from html:textarea
anymore. Please don't suggest using <html:textarea disabled="true"> instead
of <bean:write>:)
A possible solution would be having an additional getter for each string
field that would return that string in HTML format; this method would be
used for bean:writes. However, I would prefer to have an additional
attribute to bean:write (e.g keepBreaks="true") which would do the job.

Does anybody else need that? I can easily extend WriteTag myself, but I
wouldn't want to create a customized struts distribution just for my
project.

If someone knows a better solution to this, please let me know.

Oleg


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>