<%-- 优化点1:使用JSTL替代Scriptlet --%>
ot empty message}" 
<%-- 优化点2:使用EL表达式简化数据访问 --%>
${category.name}
<%-- 优化点3:使用JSTL核心标签进行循环和条件判断 --%>
${product.name}
${product.description}
<%-- 优化点1:使用JSTL替代Scriptlet --%>
ot empty message}" 
<%-- 优化点2:使用EL表达式简化数据访问 --%>
${category.name}
<%-- 优化点3:使用JSTL核心标签进行循环和条件判断 --%>
${product.description}
<%-- 优化点4:使用JSTL格式化标签 --%>
最后更新:
function addToCart(productId) {
fetch('/cart/add?productId=' + productId, {
method: 'POST'
}).then(response => {
if(response.ok) {
alert('产品已添加到购物车');
}
});
}