In this note we consider a method of generating functions for systems with constraints and, as an example, we prove that the billiard mappings for billiards on the Euclidean space, sphere, and the Lobachevsky space are sympletic. Further, by taking a quadratic generating function we get the skew-hodograph mapping introduced by Moser and Veselov, which relates the ellipsoidal billiards in the Euclidean space with the Heisenberg magnetic spin chain model on a sphere. We define analogous mapping for the ellipsoidal billiard on the Lobachevsky space. It relates the billiard with the Heisenberg spin model on the light-like cone in the Lorentz--Poincare--Minkowski space.