Coherent Dynamics of Quantum Dots in Photonic-Crystal Cavities