tags:

views:

388

answers:

2

I've drawn a blank. Does GWT have a widget that produces the HTML P tag?

I want just the P tag to appear in the DOM, without any extraneous DIV's.

+1  A: 

Have you tried HTMLPanel widget?

grigory
I believe that HTMLPanel renders a DIV element, not a P element.
David
+4  A: 

GWT doesn't have such a widget. But you can easily create one. The SimplePanel has a protected constructor which allows it to create a panel with any HTML tag. To create a panel with the P tag, simply extend the SimplePanel and create it with your own constructor:

  public class PPanel extends SimplePanel {
    public PPanel() {
      super((Element) Document.get().createPElement().cast());
    }
  }
Hilbrand
Thanks for that answer Hilbrand. By making PPanel also implement HasText, I have the solution I was seeking.
David