In this paper, we report on recent findings in the numerical solution of Hamiltonian Partial Differential Equations (PDEs) by using energy-conserving line integral methods in the Hamiltonian Boundary Value Methods (HBVMs) class. In particular, we consider the semilinear wave equation, the nonlinear Schrödinger equation, and the Korteweg–de Vries equation, to illustrate the main features of this novel approach.