A Necessary and Sufficient Condition for the Existence of Global Solutions to Semilinear Parabolic Equations on Bounded Domains