Disjoint Union of Spectra The following it from Atiyah-Macdonald's Introduction to Commutative Algebra, exercise 1.22.
Apparently this should be very easy, my apologies for asking.
I have been stuck for almost 1 day and I cannot figure out what is wrong with my arguments.

Let $A=\prod_{i=1}^n A_i$ be the direct product of rings $A_i$.
Show that $\operatorname{Spec}(A)$ is the disjoint union of open (and closed) subspaces $X_i$, where $X_i$ is canonically homeomorphic with $\operatorname{Spec}(A_i)$.

What I tried so far:
I know that $A=\prod_{i=1}^nA_i$, so I tried to find all the prime ideals in the product.
One of the lemma I showed was that for each prime ideal $\mathfrak{p}\subseteq\prod_{i=1}^nA_i$, it must be of the form:
$A_1\times\dotsb\times\mathfrak{p}_i\times\dotsb\times A_n$,
where $\mathfrak{p}_i$ is a prime ideal in $A_i$.
Hence I concluded that $\operatorname{Spec}(A)=\coprod_{i=1}^nX_i$, where $X_i=A_1\times\dotsb\times \operatorname{Spec}(A_i)\times\dotsb\times A_n$.
If my lemma is right this should cover all cases of prime ideals in $\prod_{i=1}^nA_i$,
but I have trouble when I am checking its properties.
Namely: $X_i\cap X_j$ should be $\emptyset$ for $i\neq j$, since I am looking for disjoint union.
But looking at $X_1\cap X_2$ there seems to be a non-empty intersection at
$(\operatorname{Spec}(A_1),\dots)\cap (A_1,\dots)=(\operatorname{Spec}(A_1),\dots)$.
(Or should $\operatorname{Spec}(A_1)\cap A_1=\emptyset$?)
Intuitively it seems like I may be able to define the following:
$\operatorname{Spec}(A)\cong \operatorname{Spec}(A_1)\times\dotsb\times \operatorname{Spec}(A_n)$
Then letting $X_i=(0,\dots,\operatorname{Spec}(A_i),\dots,0)$ seems to resolve the disjoint union problem.
Also, clearly each $X_i$ is a collection of prime ideals.
However, this looks like I will be missing cases like $A_1\times\dotsb\times \operatorname{Spec}(A_i)\times\dotsb\times A_n$.
Where did I go wrong?
Or am I misinterpreted anything wrongly?
Thanks for reading!
 A: I think you essentially captured the idea of the proof; but the notation is misleading.
Indeed, your $X_i$ should be defined as follows:
$$
X_i:=\{A_1\times\dots\times\mathfrak p\times\dots\times A_n\,|\,\mathfrak p\in\textrm{Spec }A_i \}\subset\textrm{Spec }A.
$$
Then of course $X_i\cong \textrm{Spec }A_i$ and $\textrm{Spec }A\cong\coprod X_i$.
A: Be careful, $\mathrm{Spec}(\mathrm A)$ is a set while $\mathrm A$ is a ring. What you have written at first is correct : the primes of the product have the form $$ \mathfrak{P} = \mathrm A_1 \times ... \times \,\mathfrak{p}_i \times ... \times \mathrm A_n$$
And we have $\mathrm X_i \simeq \mathrm{Spec}(\mathrm A_i)$.
A: $\DeclareMathOperator{\Spec}{Spec}$I think you're confusing yourself by writing $A_1\times\cdots\times\Spec(A_i)\times\cdots\times A_n$; you should immediately identify this with $\Spec(A_i)$ by the canonical homeomorphism $\mathfrak{p}\mapsto A_1\times\cdots\times\mathfrak{p}\times\cdots\times A_n$.
This should also encourage you not to talk about $A_1\cap\Spec(A_1)$; this intersection is empty simply because the two spaces contain entirely different objects, but this isn't the point. You shouldn't try to intersect $X_i$ and $X_j$ by intersecting each factor in the product seperately, but by thinking about what kind of object must lie in both - from your definition, such an object would have a prime ideal as only the $i$-th factor, and only the $j$-th factor, giving a contradiction unless $i=j$.
