This is the second time that we see David weep over his enemies, even if his enemies were the previous king, Saul, and his own son, Absalom. He tells everyone publicly that they are to deal kindly with Absalom. But remember Joab had a history with Absalom and it wasn't a good one. Joab was basically forced out and here we find him as one of the primary generals for David.
When they find Absalom hanging from a tree, a pretty funny image as you see his donkey walking without a care and without a passenger, then 10 young men slaughter him. This is so that no one person would be blamed for his death. It was not just the sword of Joab that caused the death, although it probably was. Joab had learned his lesson from those who had killed the ones chosen by the Lord and so in turn David had turned and killed those who brought the news and who had raised their hand against the chosen ones of the Lord.
The battle ended up being a slaughter and David once again is the victor. But his victory is a bitter one as he also ends up losing his son in the process. But hey, he still has a multitude of sons from his many wives from which to choose. Absalom was a trouble maker anyway as we saw.