In this paper, photosensitive phytic acid (PAGA) was synthesized via the ring opening reaction of glycidyl methacrylate and phytic acid (PA), which was used to dope polyaniline (PANI). The doped polyaniline (PAGA/PANI) was added to UV-curable resin to prepare UV-curable polyaniline anticorrosive coating. The doping of PANI by PAGA can effectively improve the dispersion of PANI in coatings. Even when the amount of PAGA/PANI increased to 2.0 wt%, PANI can still achieve uniform dispersion in the UV-curable resin. The gel content test showed that with the addition of PAGA/PANI, the curing degree of the UV-cured coating did not decrease, but slightly increased, which was attributed to the introduction of multiple photosensitive groups in PAGA, compensating for the negative effect caused by PANI. The incorporation of PAGA/PANI can also enhance the adhesion of the UV-cured coating due to the presence of phosphonic group in PAGA. With the increase of the content of photosensitive groups, the adhesion of the coating showed an increasing trend. The corrosion resistance of the coating was investigated by electrochemical impedance spectroscopy, and salt spray experiments. The impedance value of the PAGA/PANI coating was two orders of magnitude higher than that of pure resin coating during 30 days of immersion, and neither rust nor blister were observed in the salt spray test for 1000 h, suggesting the significantly enhanced anti-corrosion performance with the incorporation of PAGA/PANI.