hi mr.Ryan

I have used column decorator, tell me how to escape the apostraphe in the
column...

I have tried the way suggested by *Naveen Namburi*, but it didnot worked ...

Code:
------------------
<display:column  value="${user.id}" titleKey="user.id"   *escapeXml="true"
*headerClass="sortable" *decorator="com.sample.displaytag.TableColumnDecorator"
*/>

*TableColumnDecorator* Class

public class TableColumnDecorator implements DisplaytagColumnDecorator{

    public Object decorate(Object arg0, PageContext arg1, MediaTypeEnum
arg2) throws DecoratorException {
        //throw new UnsupportedOperationException("Not supported yet.");
         String columnValue=(String) arg0;
         columnValue=escapeSingleQuote(columnValue);
         return columnValue;
    }

    private static String escapeSingleQuote(String params)
    {
      // fix for single quote
      params = params.replace("'", "\\'");
      return params;
    }

}

--------------------------------
*Note:  *The above code didnot worked.........need help regarding

2009/7/23 Ryan Bloom <rbl...@gmail.com>

> You should be able to do this with a single column decorator instead of a
> decorator per table.  The column decorator is then attached to each column
> that has this problem.
>
> Ryan
>
> Ryan Bloom
> r...@rkbloom.net
> rbl...@gmail.com
>
>
>
> 2009/7/23 abhishek reddy <abhishek.c1...@gmail.com>
>
>> writing decorator class for each and every table is the only possible
>> solution
>>
>>
>> On Thu, Jul 23, 2009 at 6:49 PM, abhishek reddy <abhishek.c1...@gmail.com
>> > wrote:
>>
>>> hi, thanks for the reply....
>>>
>>> how did you overcome this problem?
>>>
>>>
>>> On Thu, Jul 23, 2009 at 6:37 PM, Mike McNally <emmecin...@gmail.com>wrote:
>>>
>>>> We ran into this problem too. The Displaytag "escapeXml" attribute is
>>>> too aggressive in its escaping - well, not too aggressive, just wrong
>>>> for an HTML/XHTML output context.  In my opinion it's a bug, plain and
>>>> simple. There should either be different attributes for different
>>>> sorts of escaping, or else some sort of configuration property that
>>>> would allow the behavior to be specified.
>>>>
>>>> Unfortunately I know of no way to fix it short of writing your own
>>>> decorator and applying it, or else patching your version of
>>>> Displaytag.  I find it odd that this isn't a problem sufficiently
>>>> pervasive to warrant a patch to the distribution. Surely it's not that
>>>> uncommon to have apostrophes in the sorts of columns whose contents
>>>> must be HTML-escaped.
>>>>
>>>>
>>>> 2009/7/23 abhishek reddy <abhishek.c1...@gmail.com>:
>>>> > how many such decorators i have to write?
>>>> >
>>>> > I have some around 50 to 60 tables...........do i need to write
>>>> decorator
>>>> > for each table?
>>>> >
>>>> > 2009/7/22 Naveen Namburi <naveennamb...@gmail.com>
>>>> >>
>>>> >> Hi Abhishek,
>>>> >>
>>>> >> Please use decorator and format value in decorator:
>>>> >>
>>>> >>
>>>> >> <
>>>> >>
>>>> >> display:table class="displayTable" name="requestScope.CouAppeal"
>>>> >> decorator="nj.lwd.courts.web.decorators.reftab.AppealDecorator"
>>>> >> requestURI="courtsonline.htm" sort="list">
>>>> >>
>>>> >> <
>>>> >>
>>>> >> display:column property="link1" titleKey="appeal.label.code"  />
>>>> >>
>>>> >> and in decorator
>>>> >>
>>>> >> public String getLink1()
>>>> >>         {
>>>> >>       String params=escapeSingleQuote("Your Value");
>>>> >>          return params;
>>>> >>         }
>>>> >>
>>>> >> private static String escapeSingleQuote(String params){
>>>> >>   // fix for single quote
>>>> >>   params = params.replace("'", "\\'");
>>>> >>
>>>> >>   return params;
>>>> >>  }
>>>> >>
>>>> >> Thanks,
>>>> >>
>>>> >> Naveen.
>>>> >>
>>>> >>  2009/7/22 abhishek reddy <abhishek.c1...@gmail.com>
>>>> >>>
>>>> >>> hi everyone,
>>>> >>>
>>>> >>> Problem: when the displaytag column contains apostraphe, it is
>>>> displayed
>>>> >>> as &apos; instead of ( ' )
>>>> >>>
>>>> >>> how to overcome this problem?
>>>> >>>
>>>> >>> --
>>>> >>> Abhishek
>>>> >>>
>>>> >>>
>>>> >>>
>>>> ------------------------------------------------------------------------------
>>>> >>>
>>>> >>> _______________________________________________
>>>> >>> displaytag-user mailing list
>>>> >>> displaytag-user@lists.sourceforge.net
>>>> >>> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>>>> >>>
>>>> >>
>>>> >>
>>>> >>
>>>> >>
>>>> ------------------------------------------------------------------------------
>>>> >>
>>>> >> _______________________________________________
>>>> >> displaytag-user mailing list
>>>> >> displaytag-user@lists.sourceforge.net
>>>> >> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>>>> >>
>>>> >
>>>> >
>>>> >
>>>> > --
>>>> > Abhishek
>>>> >
>>>> >
>>>> ------------------------------------------------------------------------------
>>>> >
>>>> > _______________________________________________
>>>> > displaytag-user mailing list
>>>> > displaytag-user@lists.sourceforge.net
>>>> > https://lists.sourceforge.net/lists/listinfo/displaytag-user
>>>> >
>>>> >
>>>>
>>>>
>>>>
>>>> --
>>>> Turtle, turtle, on the ground,
>>>> Pink and shiny, turn around.
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> displaytag-user mailing list
>>>> displaytag-user@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>>>>
>>>
>>>
>>>
>>> --
>>> Abhishek
>>>
>>
>>
>>
>> --
>> Abhishek
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> displaytag-user mailing list
>> displaytag-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>>
>>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> displaytag-user mailing list
> displaytag-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>
>


-- 
Abhishek
------------------------------------------------------------------------------
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to