Looting is not justified, period. This is simply robbery of stores in the middle of other lawlessness. It is not a justifiable way to show anger either, particularly when it is done against a large faceless corporation that operates nationally or even internationally. Looting of small businesses is equally vile as these are attacks on people in your own community. The looters might as well be robbing homes.
For the most part, or virtually entirely, looting is about personal gain of wealth by criminal action (robbery). It makes no other statement.
As for dealing with it, I'd say gunfire and casualties among the looters is the best deterrent there is. You don't rob / loot a store when the owner is going to shoot you if you try. You don't loot if the police show up and shoot you in the middle of your commission of a felony. That ends looting very quickly as the vast majority of looters don't see losing or risking their life for a big-screen TV as worth it.
Violent rioting has a grey zone with it. It depends on several things like what is being protested, the response of the government, and the legality (at least as far as the authorities and government are concerned) of protesting at all. So, it might be justifiable to a degree. But, even then, random smashing of windows, and trashing of property are not justifiable actions. These are rarely aimed at the target of the protest but rather simply random acts of violence.