This article tells you what to do to avoid and deal with bear attacks.
Bears will only attack if they are startled, your in their way of food, or when they see you as their food. Avoid going near bears and keep a cup with a spoon tied together on your pack, the noise will scare away the bears near by. It is also recommended that you keep your food sealed and far away from you tent to make sure you dont lure bears in. In case of an attack dont shoot unless it is your last resort, other than that walk away slowly and try to get away (tent, tree..etc). Use the bear spray only if the bear is right infront of you and is going to attack, if it knocks you down then play dead and hope he goes away.
I found this information very useful because i didnt know too much on bear attacks and it's better now, knowing what to do incase of a future bear encounter and how to hike safely in the forest where there are bears.