Naval aircraft cannot be just left on deck without maintenance and expected to operate after an extended period of time. I will restrict this to storage on deck and avoid going into operational issues like spray effects on engines as OPs question does not ask that.
There are a multitude of technologies in use to protect metal parts from corrosion, but in the end these all fight a losing battle against entropy and their effectiveness is more accurately measured in how long they can stave off corrosion.
Painted parts are probably the most resistant, as organic coatings provide a hard barrier over the vulnerable surfaces. Paint is not foolproof, however, as it can chip and crack, due to thermal stresses, FOD, etc. Furthermore, not all parts can be painted and corrosion can develop underneath paint if it has an entry point, like a rivet hole , a static discharge connector or a crack in the paint.

Where organic coatings are not suitable, for example on shock absorber struts, other coatings can be applied. For steel a common solution is a chrome layer; for aluminium, chromate conversion and anodizing. These solutions are not as effective as a coat of paint, and an aggressive-enough environment will attack even chrome layers. As an example, take landing gear struts, which have multiple exposed moving parts, many crevices to accumulate moisture and diverse metals ready to form galvanic cells.
Finally, there are places where no coating can be used at all: static dischargers. These do exactly what the name implies, ground the aircraft to allow for built up static charges to flow into the ground, so they need to be exposed and to contact (almost)bare metal on the airframe to ensure conductivity. Their connection points are typically covered in sealant after installation, but these sealants do not last forever: they weather and end up cracking after some years in the field, turning into a moisture trap and destroying the part they are on if not monitored.
Finally, a note on composite airframes.
CFRP parts are conductive and very noble, so they can easily corrode whatever metal is attached to them. This can be mitigated with careful engineering, but can come as an unexpected problem for systems suppliers that are used to installing equipment on metal airframes: an aluminium airframe will corrode before a steel tray attached to it without insulation, but the opposite will happen with a composite airframe.