2012-08-20 41 views
0

我從數據庫中提取了一些數據,包括每行的id,現在我創建了一些元素,這些元素的ID必須包含從數據庫中提取的ID。無法使用Java代碼指定元素的ID

<% 
    //Database Codes...I got the rset... 
    while (rset.next()) { 
%> 
<div id="<%=rset.getString(1)%>" class="messageContainer"> 
</div> 
<% 
    } 
%> 

我收到以下錯誤

Bad value " " for attribute "id" on element "div":An ID must not contain whitespace. 
Syntax of id: 
An ID consists of at least one character but must not contain whitespace 
+0

看起來像你把div中的空格放在...從字符串中去掉它。 – mittmemo 2012-08-20 05:32:58

回答

1

的ID將需要URL編碼。

+0

你的意思是? – 2012-08-20 05:38:12

+1

請在句子開頭使用大寫字母,並正確拼寫單詞'you'。它使文本更易於閱讀。 – 2012-08-20 05:46:23

+0

你還沒有給我答案 – 2012-08-20 05:49:02