Passing a parameter from controller to jsp using Map

A parameter can be passed from controller to jsp in several number of ways.Using MAp is one of those ways . Following is the code snippet of how parameter can be passed through map :

Map<String, Object> passParameter() {
final Map<String, Object> responseMap = new HashMap<String, Object>();
responseMap.put("quant", 11);
return responseMap;


<%@ taglib prefix="c" uri="" %>
<div class="quantValue">
<c:if test="${quant}">
<c:out>Value of quant is ${quant} </c:out>

In the above scenario, a parameter "qauant" is set in map. This map value is then read on jsp using ${quant}. 
Plain and easy. :)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s