You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2002/06/18 05:57:33 UTC

DO NOT REPLY [Bug 9939] New: - tag trims out Leading/ Trailing spaces...

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9939>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9939

<bean:write> tag trims out Leading/ Trailing spaces...

           Summary: <bean:write> tag trims out Leading/ Trailing spaces...
           Product: Struts
           Version: 1.0.2 Final
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Standard Actions
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: jeevan_sunkersett@satyam.com
                CC: jeevan_sunkersett@satyam.com


Hi,

I noticed the following behaviour of the <bean:write> tag provided by the 
STRUTS (release 1.0.2) framework. I do not know if this shud be qualified as a 
BUG or not.

A Bean which is referenced to in my JSP returns String.
The exact content of the String is say �    Jeevan�. 
In other words there are LEADING SPACES in front of the text.

I print that in JSP with 
<bean:write name=�myBean� property=�name�/>

In simple HTML if I wanted to preserve the spaces I wud replace them by �&nbsp;�
However I noticed that the <bean:write tag does not preserve the spaces, cause 
the STRUTS code does not handle it.

To ensure that SPACES are converted to �&nbsp;� with <bean:write I made a small 
change in the STRUTS code.

In com.apache.struts.util.ResponseUtils, static method : filter(String value)
Added the following case(let)

for (int i = 0; i < content.length; i++) {
  int iC = content[i];
  switch (content[i]) 
  {  ...... //the original case stmts!
     ...
     case ' ':  // if � � ie. SPACE put &nbsp; into the response.
         result.append("&nbsp;");
         break;
  }
 
  return (result.toString());

Has anyone reported a similar behaviour ? 
Are the STRUTS framework developers working on a soln! ?

rgds
G1

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