For example
// need somehow do something like this: total.put(\'key\', \'value\');
You can use JSTL <c:set> for this.
<jsp:useBean id="total" class="java.util.LinkedHashMap"/> <c:set target="${total}" property="key" value="value" />