user_1357
user_1357

Reputation: 7940

GWT: how to display unparsed html text in textarea?

I need to display raw HTML text inside the textarea without parsing it. Something like below:

<textarea>
  <a href="someurl">Click Here</a>
</textarea>

Where I should see anchor tag and all the raw HTML tags. Normally you do following:

<textarea>
  &lt;a href=&quot;someurl&quot;&gt;Click Here&lt;/a&gt;
</textarea>

Which will display the unparsed raw anchor in side the textarea. But in GWT in UiBinder "&lt;a href=&quot;someurl&quot;&gt;Click Here&lt;/a&gt;" never gets converted to <a href="someurl">Click Here</a> inside the textarea.

Is there any workaround for this?

Thanks!

Upvotes: 0

Views: 1691

Answers (1)

ben_w
ben_w

Reputation: 736

In UIBinder, another way of setting the text of a widget is to put it in the text attribute of tag. (Under the hood, this will call .setText() on the underlying widget).

So something like this might work for you (but I have not tried it):

<g:TextArea text="&lt;a href=&quot;someurl&quot;&gt;Click Here&lt;/a&gt;" />

Upvotes: 1

Related Questions