The potential of structural optimization in the design of structures is growing rapidly with the advancement of the computer technology. In this paper, a formulation of structural optimization problem using an energy method is presented, for which solution a nested bilevel optimization is utilized. The method is applied on two practical examples, namely a nonlinear sizing problem for a two span girder and a discrete shape optimization of a truss bridge. These demonstrate the applicability of the method.