Let $A \subseteq B$ be an extension of commutative rings with identity. Then $A+XB[X]$ and $A+XB[[X]]$ are the polynomial and power series rings over $B$ whose constant terms are in $A$. Is there any characterization for their (primary or prime or maximal) ideals via ideals of $A$ and $B$? (If it is necessary, we can assume $A$ and $B$ are domains.)

2$\begingroup$ Note that if $A=\mathbb{Z}$ and $B=\mathbb{Q}$ then $A+XB[X]$ is not Noetherian. This issue would not arise if $B$ was a finitely generated $A$module, so you might or might not want to assume that. $\endgroup$ – Neil Strickland Sep 16 '15 at 11:39
We have $A + X B[X] = A \times_B B[X]$, where $B[X] \to B$, $X \mapsto 0$. We also have $A + X B[[X]] = A \times_B B[[X]]$. Now it is a general fact that for a surjective homomorphism of commutative rings $C \to B$ and any homomorphism $A \to B$ the spectrum of the pullback $A \times_B C$ is given by a pushout: We have $$\mathrm{Spec}(A \times_B C) \cong \mathrm{Spec}(A) \cup_{\mathrm{Spec}(B)} \mathrm{Spec}(C)$$ in the category of locally ringed spaces. Since the forgetful functor to topological spaces is cocontinuous, this means that we also have the corresponding description in the category of topological spaces.
The problem is, however, that you cannot describe $\mathrm{Spec}(B[X])$ or even $\mathrm{Spec}(B[[X]])$ in terms of $\mathrm{Spec}(B)$. And this is what you get for $A=B$.