In this paper, we propose an energy-based nonlinear control for a two-link flexible manipulator. As it is well known, the two-link flexible manipulator is an underactuated system that provides a challenge to control engineers and researchers. Recently, many new control theories and methods are being explored to design controllers for underactuated systems in order to control them more effectively. Among these methods, the energy-based control design method has gained much attention. This method can provide more physical insights in nonlinear control as well as provide a direct candidate for the Lyapunov function, which is very important for proving the stability of closed-loop systems. Especially, the portcontrolled Hamiltonian system and generalized canonical transformation have some advantages over the modeling and control design of nonlinear systems. Therefore, we have chosen to study how to control the two-link flexible manipulator via generalized canonical transformation. Both simulation and experimental results are provided to demonstrate the effectiveness of the controllers.