Both of these forms of substitution are found in standard calculus textbooks, including free online ones, if you wish to consult them
The most general form of substitution, which is not usually found in textbooks, is for an integral of the form
$\int f(x) \; dx$, choose a relation (equation)
$g(x,u)=0$ and use it and its differential to eliminate
$x$ and
$dx$ from
$f(x) \; dx$. The two commons forms for the relation are
$u = h(x)$ and
$x = k(u)$, corresponding to the
$e^x$ and the trigonometric substitutions respectively in the W|A output. The first form
$u = h(x)$ is usually the first type of substitution introduced in calculus books. I think this is because guessing what to choose for
$h(x)$ is fairly straightforward in many integrals. The second form tends to be used in special circumstances, such as trigonometric substitution. If
$h$ or
$k$ is invertible, then one form can be converted to the other.
As an example of substitution using the general
$g(x,u)=0$, note that the integral at hand may be solved by using
$e^x - 2\tan\theta = 0$ to eliminate
$x$ and
$dx$.