struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Maier <Marco.Ma...@ics-software.de>
Subject Re: Can I have a &nbsp; _not_ URL encoded?
Date Tue, 01 Jul 2003 08:59:02 GMT
&amp; nbsp; you get only if the the filter is set to true.
see implementation of filter (org.apache.struts.util.ResponseUtils)

public static String filter(String value) {

         if (value == null)
             return (null);

         char content[] = new char[value.length()];
         value.getChars(0, value.length(), content, 0);
         StringBuffer result = new StringBuffer(content.length + 50);
         for (int i = 0; i < content.length; i++) {
             switch (content[i]) {
             case '<':
                 result.append("&lt;");
                 break;
             case '>':
                 result.append("&gt;");
                 break;
             case '&':
                 result.append("&amp;");
                 break;
             case '"':
                 result.append("&quot;");
                 break;
             default:
                 result.append(content[i]);
             }
         }
         return (result.toString());

     }

if filter is set to false, it should be normally rendered as &nbsp;

Marco


Martin Naskovski wrote:
> Hallo Marco,
> 
> Here's my code:
> 
> <html:select property="unitLocation">
>                         <bean:define id="unitLocationOptions" name="searchForm"
>                             property="unitLocationOptions"
>                             type="java.util.Collection"/>
>                         <html:option value="">Select one...</html:option>
>                         <html:options collection="unitLocationOptions"
>                                     property="value"
>                                     labelProperty="label" filter ="false"/>
>                       </html:select>
> 
> The LabelValueBean's label property is set to &nbsp;, and what I get
> on the HTML rendered is: &amp; nbsp;. I set filter to false as well.
> 
> So now I'm truly confused :)....
> 
> Martin
> 
> Tuesday, July 1, 2003, 12:45:20 AM, you wrote:
> 
> MM> Hi Martin,
> 
> MM> try to set the filter attribute of the bean:write tag to false
> MM> e.g.
> MM> <bean:write name="someForm" property="someProperty" filter="false"/>
> 
> MM> Marco
> 
> MM> Martin Naskovski wrote:
> 
>>>I have a LabelValueBean, and the Label property contains spachs.
>>>However, they do not get encoded into &nbsp;'s. If I actually include
>>>the &nbsp; tag, I get a '&nbsp;' on the screen verbatim :), instead of
>>>what I really wanted - a space.
>>>
>>>Is this some catch-22 or is there really a way to specify a
>>>&nbsp; for a label property in a LabelValueBean? Can the ampersand be
>>>escaped somehow??? Thanks :).
>>>
>>>Martin
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>>
>>>
>>>
> 
> 
> 
> 
> MM> ---------------------------------------------------------------------
> MM> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> MM> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> 



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


Mime
View raw message