Reputation: 2827
i'm new to jsp + spring and i have this problem: i have two @RequestMapping that respond to "onWork" and "onPending". Both return a list of activities and i would like to call them in the same page, for example:
<div id="onWork">
here i want to display onWork
</div>
<div id="onPending">
here i want to display onPending
</div>
I really like to modularize them and create two page: one that display onWork and another that display onPenging, so i could reuse that "fragment" every time i want, without duplicate the code.
How can i do that using jsp, jsp:invoke, jsp:fragment etc ?
Thanks
Upvotes: 0
Views: 64
Reputation: 16100
You should probably use <c:import>
from the JSTL to import a common fragment, or <jsp:include>
, which allows you to pass variables into the fragment, which you'll probably need to do from the fragment's parent, in each of the divs you're shown above (see <jsp:param>
).
Upvotes: 1