It is well known that the initial and boundary value problem for scalar conservation laws may not have solutions. Several authors proposed appropriate notions of solutions with boundary conditions satisfied in a generalized sense. We consider scalar conservation
laws on the strip (0,infty) x [0,1] with strictly convex smooth flux of a superlinear growth. We associate to it a Hamilton-Jacobi equation with initial and (appropriately defined) boundary conditions and show that it has a unique generalized solution V that can be obtained as minimum of three value functions of the calculus of variation. The traces of the gradients V_x satisfy then generalized boundary conditions in a weak sense that was proposed by LeFloch (1988) for conservation
laws with discontinuous initial and boundary conditions. We shall discuss a more precise version of these boundary conditions and show that they are satisfied in a pointwise manner when the initial and boundary data are continuous and in a weak sense when they are discontinuous.