Using electron beam irradiation, cathodoluminescence, and photoluminescence under ultrahigh vacuum conditions, we study the effect of spontaneous polarization on polar (0001) and nonpolar (1100) GaInN/GaN quantum well structures. We use cathodoluminescence measurements with an electron beam irradiation time of up to several hours. A drastic blueshift of the quantum well emission accompanied by a 100-fold increase of intensity is observed in polar samples. These changes can be described by an activation of the spontaneous polarization field due to the desorption of surface charges, which counteracts the piezoelectric field in the quantum well. Etching or annealing of the surface leads to similar effects. The influence of the sample structure was investigated by varying the cap thickness of the samples. A different time- dependent behavior of changes in the quantum well emission energy and the intensity depending on cap thickness and acceleration voltage was observed. This can be explained by de-screening and screening effects induced by the electron beam which are discussed in detail. For nonpolar (1100) samples, no change in quantum well emission energy or intensity was observed. This is consistent with a spontaneous-polarization-induced surface field in the c-plane case and verifies the absence of the spontaneous polarization field in the nonpolar (1100) direction.