  Consider a bounded solution of the focusing, energy-critical wave equation
that does not scatter to a linear solution. We prove that this solution
converges in some weak sense, along a sequence of times and up to scaling and
space translation, to a sum of solitary waves. This result is a consequence of
a new general compactness/rigidity argument based on profile decomposition. We
also give an application of this method to the energy-critical Schr\"odinger
equation.
