Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've used in the same situation at least two (more or less similar) solutions.</p> <ol> <li><p>Use included JSP. The first request (page with list of product images and links) should return JSP for the whole page, e.g.</p> <pre><code>&lt;%@page contentType="text/html; charset=UTF-8"%&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; ... skipped ... &lt;c:forEach items="${products}" var="product"&gt; &lt;%@include file="productInfo.jsp"%&gt; &lt;/c:forEach&gt; ... skipped ... &lt;/html&gt; </code></pre> <p>Second request (AJAX request for continuation of the list) should return JSP with requested part of list:</p> <pre><code>&lt;c:forEach items="${products}" var="product"&gt; &lt;%@include file="productInfo.jsp"%&gt; &lt;/c:forEach&gt; </code></pre> <p>Its content may be inserted by AJAX response handler in browser into DOM without any additional processing. Note that both responses include the same JSP to render information about the single product.</p></li> <li><p>Instead of <code>&lt;%@include file="..."%&gt;</code> you may use <a href="http://docs.oracle.com/javaee/5/tutorial/doc/bnama.html" rel="nofollow">JSP tags</a>. The rest looks similar: JSP for the whole page</p> <pre><code>&lt;%@page contentType="text/html; charset=UTF-8"%&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; ... skipped ... &lt;c:forEach items="${products}" var="product"&gt; &lt;tag:productInfo product="${product}" /&gt; &lt;/c:forEach&gt; ... skipped ... &lt;/html&gt; </code></pre> <p>JSP with requested part of list:</p> <pre><code>&lt;c:forEach items="${products}" var="product"&gt; &lt;tag:productInfo product="${product}" /&gt; &lt;/c:forEach&gt; </code></pre></li> </ol> <p>This way you can reuse single view (JSP) for both responses (AJAX and non-AJAX), and eliminate second rendering mechanism for AJAX (JSON + manual DOM fragment creation from JavaScript).</p>
    singulars
    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.
    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