You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Luther Baker <lu...@gmail.com> on 2009/03/03 18:58:05 UTC

GenericSelectOption

I have implemented this and which to display a special character in the drop
down.

&ni;

Only, whenever I return this via the 'toClient' method of the ValueEncoder
for this, the result ends up being &amp;ni; which prints miserably.

Is there a different way to feed the String value into Tapestry such that it
won't convert '&' to &amp; -- or, is there a better way to push special
characters into the drop down options.

-Luther

Re: GenericSelectOption

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 03 Mar 2009 16:16:29 -0300, Luther Baker <lu...@gmail.com>  
escreveu:

> I would like to display it as an option LABEL.

Select does this encoding by default (security reasons, I guess) and does  
not offer an option to do otherwise. Feel free to post a JIRA about that.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: GenericSelectOption

Posted by Luther Baker <lu...@gmail.com>.
I would like to display it as an option LABEL.

To test this, from within my GenericSelectOption<T> class - I've explicitly
made the label a list of special characters:

    public List<OptionModel> getOptions()
    {
        List<OptionModel> optionModelList = new ArrayList<OptionModel>();
        for (Initiative obj : this.list)
        {
            optionModelList.add(new OptionModelImpl(*"&nbsp; &ni; &amp;
&nbsp;"*, obj));
        }
        return optionModelList;
    }


and for what its worth from tapestry's OptionModelImpl:

public class OptionModelImpl extends AbstractOptionModel
{
    public OptionModelImpl(String label, Object value)
    {
        this.label = label;
        this.value = value;
    }


and in this case, I'm seeing

<option value="Notebook">&amp;nbsp; &amp;ni; &amp;amp; &amp;nbsp;</option>

outputt'd to the page.

-Luther

...
}





On Tue, Mar 3, 2009 at 12:58 PM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> Em Tue, 03 Mar 2009 14:58:05 -0300, Luther Baker <lu...@gmail.com>
> escreveu:
>
>  I have implemented this and which to display a special character in the
>> drop down. &ni; Only, whenever I return this via the 'toClient' method of
>> the ValueEncoder for this, the result ends up being &amp;ni; which prints
>> miserably.
>> Is there a different way to feed the String value into Tapestry such that
>> it won't convert '&' to &amp; -- or, is there a better way to push special
>> characters into the drop down options.
>>
>
> Do you want to output &ni; as an option value or as an option label?
> ValueEncoders are used to produce the value. OptionModer is the one which
> carries the labels.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: GenericSelectOption

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 03 Mar 2009 14:58:05 -0300, Luther Baker <lu...@gmail.com>  
escreveu:

> I have implemented this and which to display a special character in the  
> drop down. &ni; Only, whenever I return this via the 'toClient' method  
> of the ValueEncoder for this, the result ends up being &amp;ni; which  
> prints miserably.
> Is there a different way to feed the String value into Tapestry such  
> that it won't convert '&' to &amp; -- or, is there a better way to push  
> special
> characters into the drop down options.

Do you want to output &ni; as an option value or as an option label?  
ValueEncoders are used to produce the value. OptionModer is the one which  
carries the labels.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: GenericSelectOption

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 03 Mar 2009 18:39:55 -0300, Luther Baker <lu...@gmail.com>  
escreveu:

> That indeed works out just as well for me.
> Let me know if this is something I should open a JIRA ticket for - I've  
> not done that before and not sure of the process but wouldn't mind at  
> all.

Thinking about it again, I don't think it's JIRA worthy as there is an  
elegant and recommended solution to the problem.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: GenericSelectOption

Posted by Luther Baker <lu...@gmail.com>.
That indeed works out just as well for me.

Let me know if this is something I should open a JIRA ticket for - I've not
done that before and not sure of the process but wouldn't mind at all.

Thanks,

-Luther



On Tue, Mar 3, 2009 at 1:43 PM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> Em Tue, 03 Mar 2009 14:58:05 -0300, Luther Baker <lu...@gmail.com>
> escreveu:
>
>  I have implemented this and which to display a special character in the
>> drop down. &ni;
>>
>
> A better solution would be to give Select an already Unicode-encoded string
> intead of relying in HTML entities. Intead of something like String label =
> "&ni;", use label = "\u220B" (or whatever the hexadecimal code point for &ni
> is).
>
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: GenericSelectOption

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 03 Mar 2009 14:58:05 -0300, Luther Baker <lu...@gmail.com>  
escreveu:

> I have implemented this and which to display a special character in the  
> drop down. &ni;

A better solution would be to give Select an already Unicode-encoded  
string intead of relying in HTML entities. Intead of something like String  
label = "&ni;", use label = "\u220B" (or whatever the hexadecimal code  
point for &ni is).

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org