When does a PDE solve a variational problem?
The problem of determining a Lagrangian (and so the action functional) such that the corresponding Euler-Lagrange equation equal a given PDE is known as the inverse problem of variational calculus. See wikipedia (http://en.wikipedia.org/wiki/Inverse_problem_for_Lagrangian_mechanics) for an introduction and nlab (http://ncatlab.org/nlab/show/variational+bicomplex) for a mathematical generalization of this idea (especially the references in the later are useful: Takens/Zuckermann/...).