Note that there are some explanatory texts on larger screens.

plurals
  1. POShopping car JSP : Need item rows to stay on the product page when one or more items are selected and submitted to cart
    primarykey
    data
    text
    <p>I have a shopping cart application where in the items are displayed as rows of a table. At the end of each row, there is an "Add to Cart" submit button. Currently, when I click that button the entire page disappears and an error 404 page appears as the form is submitted to the servlet. What I want is that when one row is submitted, the rest of the rows remain and only the clicked row changes color. As the user adds more rows(items), each one of those rows should change color. I have got the changing color part, but have not been able to figure out how to make the rest of the rows stay on the page. </p> <pre><code> &lt;h1&gt; Here is the product list as per your category selection&lt;/h1&gt; &lt;table cellpadding="10" border="1" id="tbl"&gt; &lt;tr valign="bottom" style="background-color: #FF00FF"&gt; &lt;th align="left"&gt;Sl No&lt;/th&gt; &lt;th align="left"&gt;Prod ID&lt;/th&gt; &lt;th align="left"&gt;Unit Price&lt;/th&gt; &lt;th align="left"&gt;Quantity&lt;/th&gt; &lt;th align="left"&gt;&lt;/th&gt; &lt;/tr&gt; &lt;form name="tableForm" &gt; &lt;c:forEach items="${listInServlet1}" var="regBean"&gt; &lt;tr style="background-color: #00FFFF"&gt; &lt;input type="hidden" value="sval" name="qtyTextHidden" /&gt; &lt;input type="hidden" name="reagentId" value="&lt;c:out Value = " ${regBean.prodId} "/&gt;" /&gt; &lt;td&gt; &lt;c:out Value="${regBean.prodCount}" /&gt; &lt;/td&gt; &lt;td&gt; &lt;c:out Value="${regBean.prodId}" /&gt; &lt;/td&gt; &lt;td&gt; &lt;c:out Value="${regBean.price}" /&gt; &lt;/td&gt; &lt;td&gt; &lt;input name="qtyText" type="text" size="2" value="" onChange="calculateTotalPrice(this, '${regBean.price}')" /&gt; &lt;/td&gt; &lt;td&gt; &lt;input name="totalprice" type="text" size="2" value="0" /&gt; &lt;/td&gt; &lt;td&gt; &lt;input type="submit" value="Add to Cart" name="addToCrtBtn" onClick="submitValues(event, '${regBean.prodCount}', '${regBean.price}')" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt; &lt;/form&gt; &lt;/table&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;form name="tableForm" method="post" action="/myapp/myservlet"&gt; &lt;input type="submit" value="Done" id="submitOrder" /&gt; &lt;/form&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload