Clear[L,x,t]
L=
δW=D[L,x[t]]-D[D[L,D[x[t],t]],t]

Clear[x,f,df,H,L,F];
F[x_,f_,df_]=df^2+3 x f;
L[F_]:=D[F,y[x]]-D[D[F,y'[x]],x];
eq=L[F[x,y[x],y'[x]]]
s=DSolve[{eq==0,y[0]==0,y[Pi/2]==1},y[x],x]//Flatten
ff=y[x]/.s;
dff=D[y[x]/.s,x];
Integrate[F[x,ff,dff],{x,0,Pi/2}]

Clear[x,f,df,H,L,F];
g=y[x]
F[x_,f_,df_]:=df^2+λ g ;
L[F_]:=D[F,y[x]]-D[D[F,y'[x]],x];
eq=L[F[x,y[x],y'[x]]]
s=DSolve[{eq==0,y[0]==0,y[2]==4},y[x],x]//Flatten//FullSimplify
s2=Solve[Integrate[y[x]/.s,{x,0,2}]==10/3,λ]
y[x]/.s/.s2

Clear[x,f,df,L,F];
g=y[x]
F[x_,f_,df_]:=df^2+x^2+λ g ;
L[F_]:=D[F,y[x]]-D[D[F,y'[x]],x];
eq=L[F[x,y[x],y'[x]]]
s=DSolve[{eq==0,y[0]==0,y[2]==1},y[x],x]//Flatten//FullSimplify
s2=Solve[Integrate[y[x]/.s,{x,0,2}]==1/3,λ]
y[x]/.s/.s2//Expand