2012-07-22 51 views
0

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

所以这个问题是第一次当datatable生成,我点击任何链接所需的数据永远不会出现在第一次按钮点击模式面板。但如果我回去并再次回到相同的页面,则需要的数据出现在模式面板中。请为我提供解决方案。

通过比较第一次和第二次加载页面的视图源,我也注意到了一些奇怪的事情,数据表名在第一次出现时没有表单名称,例如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代码来像:

<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;"> 

和第二timme样子:

<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> 
+0

您只发布了表头,表格其余部分的HTML代码在哪里? – Tomer 2012-07-22 15:51:33

回答

0

似乎你有一个身份证问题。

当创建一个标签,你可以设置for属性在具有相同ID的输入点:

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

既然你没有张贴这是很难说清楚的任何HTML,但你可能有一个标签空for

<label for=""> 

for在错误的ID指向:

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

< f:facet name =“openMarker”> \t 这是用于数据表的jsp代码。 – user1543894 2012-07-22 13:32:03

+0

请编辑该问题并将其放在那里。也请把实际生成的HTML不是代码。 – Tomer 2012-07-22 13:32:36

+0

@ user1543894使用JSF代码编辑您的问题,同时添加您正在使用的JSF和RichFaces版本。 – 2012-07-22 15:49:01