簡體   English   中英

JSF中動態數據表的問題

[英]Issue with dynamic datatable in JSF

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

第二個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>

好像您有ID問題。

創建標簽時,可以將for屬性設置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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM