mercredi 8 février 2017

How to iterate hashmap containing Object and array object, in jsp using jstl

Vote count: 0

I am not very good in JSTL. I would be glad to get some help.

I have below Map object in my java class:

Map<Integer, Result[]> qrCodeMap = new HashMap<Integer, Result[]>();
Result qrCodeResult[] = null;

...............(some lines of code)

for (int i = 0; i < pageCount; i++) 

{
..............
qrCodeResult = new QRCodeMultiReader().decodeMultiple(binaryBitmap, hintMap);
qrCodeMap.put(new Integer(i + 1), qrCodeResult);
 }

Now my qrCodeMap has Integer and Result[] array object

I add this map object to model in my Spring Controller :

model.addAttribute("qrCodeMap", qrCodeMap);

I want to display qrCodeMap in jsp using jstl. Could you please tell me how I should iterate through qrCodeMap (ie. a Map) in jsp? Below is my incomplete code:

<c:forEach var="qrCode" items="${qrCodeMap}">
For Page ${qrCode.key} , QR Codes : 
<c:forEach items="${qrCode.value}" var="item">
</c:forEach>
</c:forEach> 

If it is easier to do through scriplets, then kindly suggest the syntax. Thanks in advance.

asked 22 secs ago

Let's block ads! (Why?)



How to iterate hashmap containing Object and array object, in jsp using jstl

Aucun commentaire:

Enregistrer un commentaire