We propose an approach for calculating one-loop effective actions and vacuum energies in quantum field theory. Spectral functions are functions defined by the eigenvalues of an operator. One-loop effective actions and vacuum energies in quantum field theory, as well as scattering phase shifts and scattering amplitudes in quantum mechanics, are all spectral functions. If a transformation between different spectral functions is identified, we can obtain a spectral function from another through the transformation. In this paper, we convert quantum mechanical methods for calculating scattering phase shifts and scattering amplitudes into quantum field theory methods for calculating one-loop effective actions and vacuum energies. As examples, the Born approximation and the WKB approximation in quantum mechanics are converted into quantum field theory methods. We also calculate the one-loop effective action and vacuum energy of scalar fields in the Schwarzschild spacetime and the Reissner-Nordstr\"{o}m spacetime as examples. Some integral representations of the Bessel function are given in appendices.