0
我有一個通知消息列表,我從數據庫中提取並放入會話中的一個servlet中。然後使用requesDipstacher.forward(request,response
轉發到一個jsp頁面)。我現在採取的消息和循環播放的列表,通過使用JSTL:如何在會話中使用列表並在Javascript中使用它
<c:foreach value = "item" items = '${sessionScope.notification}'>
<a href = "javascript:printAll('${item}'}>Print</a>
</c:foreach>
的JavaScript看起來像這樣
function printAll(item)
{
display(item) //note this is pseudo code . Here I kind of display the items.
}
現在我的問題是,有太多太多的鏈接在我的網頁顯示print
。我想將整個列表發送到JavaScript並遍歷它並顯示單個消息。這可能與JavaScript.Kindly指出我相同的問題,如果它存在。
什麼是項目?什麼包含? – 2012-07-16 17:01:49
item只是列表中contsins在那個迭代值 – 2012-07-16 17:13:09
你的意思,你不想多次顯示打印?那麼當你想顯示該通知消息?請讓我們知道你想要什麼,更清晰的方式? – 2012-07-16 17:09:37