For continuous functions $g:[0,1]\times\er\to\er$ we prove that the functional $\Phi(u)=\int_0^1 g\bigl(x,u(x)\bigr) \d x$ is weakly continuous on $W^{1,p}_0(0,1)$, $1\leq p lt \infty$, if and only if $g$ is linear in the second variable.