For treatment, ice is used to reduce the swelling and inflammation. You should stop doing the activities that brought on the pain. Non-steroidal pain medications, a knee brace, and rehabilitation programs are also often beneficial.
In terms of prevention, stretching before workouts, eliminating painful excercises from your routine, and using proper equipment are usually recommended by your doctor.