My understanding of JSP is that each line in the java code is run step by step (in sequence). E.g. if I have a code below, doSomething("apple")
will be executed first until it returns a value, then doSomething("orange")
will be executed next until it returns a value, then finally doSomething("pear")
will be executed until it returns a value and the whole page is displayed.
<table border="1">
<thead>
<tr>
<th>Test</th>
</tr>
</thead>
<tbody>
<tr>
<td>Column A</td>
<td><%=javaBean.doSomething("apple")%></td>
</tr>
<tr>
<td>Column B</td>
<td><%=javaBean.doSomething("orange")%></td>
</tr>
<tr>
<td>Column C</td>
<td><%=javaBean.doSomething("pear")%></td>
</tr>
</tbody>
</table>
What is the best way to make these calls parallel e.g. run doSomething("apple") & doSomething("orange") & doSomething("pear")
concurrently? Thank you.