If $(X,A)$ has homotopy extension, then $X \times I$ def. retracts to $X \times \{0\} \cup A \times I$ Exercise 0.26 in Hatcher's Algebraic Topology is

Use Corollary 0.20 to show that if $(X,A)$ has the homotopy extension
  property, then $X \times I$ deformation retracts to $X \times \{0\}
 \cup A \times I$.

Here Corollary 0.20 says 

Corollary 0.20: If $(X,A)$ satisfies the homotopy extension property and the inclusion $A \hookrightarrow X$ is a
  homotopy equivalence, then $A$ is a deformation retract of $X$.

My answer to the exercise seemed a little too neat, and I wanted to double-check. Let $\iota: X \times \{0\} \cup A \times I \to X \times I$ be the inclusion. From the fact that $(X,A)$ has the homotopy extension property, we get a retract $r:X \times I \to X \times \{0\} \cup A \times I$. Since $r \circ \iota$ is already the identity, we just need to show that $\iota \circ r$ is homotopic to $1_{X \times I}$. 
To do this, I just showed that $1_{X \times I}$ and $\iota \circ r$ both homotope to the same map, namely $\pi: (x,t) \mapsto (x,0)$. The former is obvious; for the latter, if $F$ is the homotopy from $1_{X \times I}$ to $\pi$ then $\iota \circ r \circ F$ is a homotopy from $\iota \circ r$ to $\pi$.
Does that seem right? It seemed a little too easy.
Thinking about how to generalize this, it seems like given $A \subset X$, we can say that $A \simeq X$ so long as we have a map $X \to A$ which is the identity on a space $B \subset A$ where $B$ is a deformation retract of $X$. Is there a better way to generalize?

Edit: Stefan Hamcke points out that I also need to show that $X \times I, X \times \{0 \} \cup A \times I$ has the homotopy extension property, and since this was not obvious to me at first, I will record the proof here for reference. 
We have a retract $r: X \times I \to X \times \{0\} \cup A \times I$, and we want to find a retract $\rho: X \times I \times I \to X \times I \times \{0\} \cup (X \times \{0\} \cup A \times I ) \times I$ $= X \times (\{0\} \times I \cup I \times \{0\}) \cup A \times I \times I$. We can use $r$ to get a retract from $X \times I \times I \to (X \times \{0\} \cup A \times I )\times I$. But there is an automorphism of $X \times I \times I$ which takes $X \times (\{0\} \times I \cup I \times \{0\})$ homeomorphically to $X \times \{0\} \times I$, where we just imagine sliding deforming the points on the boundary square, and then extending this to the solid square. See here.
 A: You are right. Since $1_{X\times I}$ is homotopic to $\pi$, we have $\iota r\simeq \iota r\pi=\pi\simeq 1_{X×I}$, which shows that $\iota$ and $r$ are homotopy inverse to each other.
It is indeed that easy. To be honest, you can have it even easier by using the general fact that if some map $f$ and the composite $gf$ are homotopy equivalences, then the map $g$ is a homotopy equivalence as well. More precisely, if $h$ is the homotopy inverse of $gf$, then $fh$ will be the homotopy inverse of $g$, as one checks by the calculation
$$g(fh)=(gf)h\simeq 1 \\
(fh)g\simeq(fh)g(fk)=f(h(gf))k\simeq fk\simeq 1$$
where $k$ is the homotopy inverse of $f$. This also shows that $k\simeq hg$.  
Setting $f:X\times\{0\}\hookrightarrow X×\{0\}\cup A×I$ and $g=\iota$, can you see what the homotopy inverses for $f$ and $\iota f:X×\{0\}\hookrightarrow X×I$ are? Actually, you already used it in your proof.
The general proof shows that $X×\{0\}\cup A×I\hookrightarrow X\times I$ is always a homotopy equivalence, though it's a deformation retract only if $(X,A)$ has the HEP.
