0

我在java中遇到了动态数据表的问题。我正在一个简单的切换面板中创建多个动态数据表。生成数据表并正确显示在表单(jsp 页面)中。数据也填充在表中。当我单击表中的任何命令链接时,它会打开模式面板但不显示任何数据。当我再次刷新页面然后单击命令链接时,模式面板正在显示数据。

所以问题是第一次生成数据表并且我单击任何链接所需的数据永远不会在第一次按钮单击时出现在模态面板中。但是,如果我返回并再次返回同一页面,则模态面板中会出现所需的数据。请建议我解决这个问题。

通过比较第一次和第二次加载页面的视图源,我还注意到奇怪的事情,数据表名称第一次出现时没有表单名称,如 DATA_TABLE_NAME,第二次数据表名称出现表单名称,例如 formName:DATA_TABLE_NAME

我一直在复制数据表的日志两次。这是第一次:

17:04:14,327 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,327 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,327 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,327 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,327 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,327 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,343 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,343 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,343 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,343 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,343 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:j_id165 just got an automatic id, because there was no id assigned yet.
17:04:14,343 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:j_id166 just got an automatic id, because there was no id assigned yet.
17:04:14,343 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id167 just got an automatic id, because there was no id assigned yet
17:04:14,343 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id168 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id169 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id170 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id171 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id172 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id173 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id174 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id175 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id176 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id177 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id178 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id179 just got an automatic id, because there was no id assigned yet

这是第二次

16:49:34,264 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id105 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,264 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id106 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,264 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id107 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,264 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id108 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,279 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id109 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,279 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id110 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,279 WARN  [HtmlImageRendererBase] ALT attribute is missing for : null
16:49:34,279 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id111 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,295 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id112 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,295 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id113 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,295 WARN  [HtmlImageRendererBase] ALT attribute is missing for : null
16:49:34,295 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id114 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,295 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id115 just got an automatic id, because there was no id assigned yet. If this compo

第一次 HTML CODE 是这样的:

<table class="rich-table " id="ST_DATATBL_ID_0" border="0" cellpadding="0" cellspacing="0" width="100%">
<colgroup span="12"></colgroup>
<thead class="rich-table-thead">
<tr class="rich-table-header  ">
<th class="rich-table-headercell " id="ST_DATATBL_ID_0:j_id107" width="20"></th>
<th class="rich-table-headercell " id="ST_DATATBL_ID_0:j_id108" width="2"></th>
<th class="rich-table-headercell " id="ST_DATATBL_ID_0:j_id109">ITEM #<img alt="" class="rich-spacer " height="1" id="ST_DATATBL_ID_0:j_id110" src="/pgsportal/a4j/g/3_3_3.Finalimages/spacer.gif.jsf" width="10%" />
<a href="#" id="ST_DATATBL_ID_0:j_id111" name="ST_DATATBL_ID_0:j_id111" onclick="A4J.AJAX.Submit('scopeItemsForm',event,{'status':'notrequired','similarityGroupingId':'ST_DATATBL_ID_0:j_id111','parameters':{'ST_DATATBL_ID_0:j_id111':'ST_DATATBL_ID_0:j_id111'} ,'containerId':'j_id0'} );return false;">

第二次看起来像:

    <table class="rich-table " id="scopeItemsForm:ST_DATATBL_ID_0" border="0" cellpadding="0" cellspacing="0" width="100%">
    <colgroup span="12"></colgroup>
    <thead class="rich-table-thead"><tr class="rich-table-header  ">
    <th class="rich-table-headercell " id="scopeItemsForm:ST_DATATBL_ID_0:j_id107" width="20"></th><th class="rich-table-headercell " id="scopeItemsForm:ST_DATATBL_ID_0:j_id108" width="2"></th>
    <th class="rich-table-headercell " id="scopeItemsForm:ST_DATATBL_ID_0:j_id109">ITEM #
    <img alt="" class="rich-spacer " height="1" id="scopeItemsForm:ST_DATATBL_ID_0:j_id110" src="/pgsportal/a4j/g/3_3_3.Finalimages/spacer.gif.jsf" width="10%" />
    <a href="#" id="scopeItemsForm:ST_DATATBL_ID_0:j_id111" name="scopeItemsForm:ST_DATATBL_ID_0:j_id111" onclick="A4J.AJAX.Submit('scopeItemsForm',event,{'status':'notrequired','similarityGroupingId':'scopeItemsForm:ST_DATATBL_ID_0:j_id111','parameters':{'scopeItemsForm:ST_DATATBL_ID_0:j_id111':'scopeItemsForm:ST_DATATBL_ID_0:j_id111'} ,'containerId':'j_id0'} );return false;"><img src="../images/down_arrow.png" /></a>
4

1 回答 1

0

好像你的ID有问题。

创建标签时,您可以将for属性设置为指向具有相同 id 的输入:

<label for="someId">
    <input name="someInput" id="someId"/>
</label>

由于您没有发布任何 HTML,因此很难准确地说出,但您可能有一个带有 empty 的标签for

<label for="">

for指向错误的ID:

<label for="someId">
    <input name="someInput" id="someOtherId"/>
</label>
于 2012-07-22T12:54:29.437 回答