首先,我想知道我的方法是否正確。 我有存儲在xml文件中的產品。我將閱讀這個文件,並存儲產品,以便我可以將它傳遞給JSP頁面。這裏是我的Product.xml文件從servlet類讀取XML文件並在JSP頁面上顯示
我也想知道,我應該使用什麼樣的數據結構。由於在產品頁面上,我將爲每個產品都有一個ADD TO CART按鈕。
<inventory>
<product>
<name>Dictionairy</name>
<description>Words from the English language</description>
<price>400</price>
</product>
<product>
<name>Calculator</name>
<description>solving numbers</description>
<price>1000</price>
</product>
<product>
<name>LCD</name>
<description>displaying output from computer</description>
<price>8000</price>
</product>
</inventory>
首先,使用XML文件作爲數據庫已經很糟糕。這是效率低下和內存佔用。有什麼特別的原因讓你無法使用SQL數據庫嗎? – BalusC 2011-03-28 13:25:49