struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject bean:write filtering and newlines
Date Thu, 31 Oct 2002 18:08:59 GMT

the problem is mentioned here
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

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


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message