问题
I get this error when I run my Gwt app
Found widget in an HTML context
Here is a snippet of the xml that it complains about:
<!-- ... -->
<g:HTML ui:field="localPanel">
<fieldset>
<legend>Local</legend>
<label for="btn" >BTN:</label><input type="text" ui:field="btn" class="txtbx numeric" maxlength="10" name='btn'/>
<label for="stdprt">SDT PRT:</label><input type="text" ui:field="stdprt" class="txtbx" readonly="readonly" name='stdPrt'/>
<label for="rateArea">Rate Area:</label><input type="text" ui:field="ratearea" class="txtbx" readonly="readonly" name='rateArea'/>
<br/>
<label for="deleteDigits">Delete Digits:</label><g:ListBox ui:field='deletedigs' class="dropdownbx" name='deleteDigits'/>
</fieldset>
</g:HTML>
<g:Button ui:field="submit2">Submit</g:Button>
</g:HTMLPanel>
回答1:
There are certain tags (those which GWT says are make an "HTML context") that can't have widgets inside them. For instance, <g:HTML><g:Label /></g:HTML>
is illegal because a only expects HTML elements and not widgets. However, if you change that to <g:HTMLPanel><g:Label /></g:HTMLPanel>
it will work.
The particular snippet triggering the error in your code is the <g:ListBox ui:field='deletedigs' class="dropdownbx" name='deleteDigits'/>
that's contained in the <g:HTML ui:field="localPanel">
. Make that <g:HTML>
into a <g:HTMLPanel>
and it should all work.
来源:https://stackoverflow.com/questions/2745211/what-is-this-error-found-widget-glistbox-class-dropdownbx-name-deletedigits