A mean-field approach to the electrostatics for solutes in electrolyte solution is revisited and rigorously justified. In this approach, an electrostatic free energy functional is constructed that depends solely on the local ionic concentrations. The unique set of such concentrations that minimize this free energy are given by the usual Boltzmann distributions through the electrostatic potential which is determined by the Poisson-Boltzmann equation. This approach is then applied to the variational implicit solvent description of the solvation of molecules McCammon, Phys. Rev. Lett., 96, 087802, 2006, and J. Chem. Phys., 124, 084905, 2006]. Care is taken for the singularities of the potential generated by the solute point charges. The variation of the electrostatic free energy with respect to the location change of solute-solvent interfaces, i.e., dielectric boundaries, is derived. Such a variation gives rise to the normal component of the effective surface force per unit surface area that is shown to be attractive to the fixed point charges in the solutes. Two examples of applications are given to validate the analytical results. The first one is a one-dimensional model system resembling, e.g., a charged solute or cavity in a one-dimensional channel. The second one, which is of its own interest, is the electrostatic free energy of a charged sphercal solute immersed in an ionic solution. An analytical formula is derived for the Debye-Hückel approximation of the free energy, extending the classical Born's formula to one that includes ionic