This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I am having difficulties while doing the grouping in a jsp.
I am having a table which is retrieving the employee No., Directorate. The directorate name is coming duplicate as it is retrieved from the DB.
My jsp is displaying:
So, I want it in the jsp as:
Can you please help.
This is not something you should do right in the JSP. You can make a list of employees for each directorate from somewhere in your business classes, and make your controller to set a request attribute carrying the list of directorates. Here, each directorate object should either contain or mapped to a list of corresponding employee objects. From the JSP, you can iterate over this directorates list using forEach tag of the JSTL core library. At each iteration, you can have another (nested) forEach iteration to iterate over the corresponding employee objects.