What is this error Found widget <g:ListBox class='dropdownbx' name='deleteDigits' ui:field='deletedigs'> in an HTML context
I get this error when I run my 开发者_如何学JAVAGwt 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>
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.
精彩评论