I know that if $f$ is surjective then $f(\mathfrak{a})$ is an ideal for every ideal $\mathfrak{a}$ in $A$. I want to first prove that if $\mathfrak{m}$ is maximal in $A$ then $f(\mathfrak{m}) = \mathfrak{m'}$ is maximal in $B$.
$A/\mathfrak{m}$ is a field by maximality of $\mathfrak{m}$ and $f$ induces $f^* : A/\mathfrak{m} \twoheadrightarrow B / \mathfrak{m'}$. If $I' \leqslant B / \mathfrak{m}'$ is an ideal and $f^{*-1}(I')$ must either be $(0 + \mathfrak{m})$ or $(1 + \mathfrak{m}) = I$. If the latter then $f^*(I) = B/\mathfrak{m'}$ because $f^*$ is surjective, but $f^*(f^{*-1}(I')) \subset I'$ so $I' = B/\mathfrak{m'}$ the whole ring. And if $I = (0 + \mathfrak{m})$ then $f^*(f^{*-1}(I')) = 0$ so that $I'$ can only be $0$. So, $B / \mathfrak{m'}$ is a field and $\mathfrak{m'}$ is maximal.
Is the above proof valid?
We want to show that $f(\bigcap\limits_{\mathfrak{m} \text{ maximal}} \mathfrak{m}) \subset \bigcap\limits_{\mathfrak{m}' \text{ maximal}} \mathfrak{m'}$.
Next, the inverse map $f^{-1}$ takes maximal ideals in $B$ over to maximal ideals in $A$ so $f(\bigcap \mathfrak{m}) \subset \bigcap f(\mathfrak{m}) = \text{rad}(B)$.
Now how do I prove the question in the title?
A semilocal ring is one with a finite number of maximal ideals $\mathfrak{m}_1, \dots, \mathfrak{m}_n$.
Each one of these ideals is pairwise coprime so that $\phi : A / \mathfrak{m}_1 \times \dots \times A / \mathfrak{m}_n \xrightarrow{\sim} A / (\mathfrak{m}_1 \cap \dots \cap \mathfrak{m}_n)$ is an isomorphism. But in the first proof, those field homomorphism, since they weren't identically $0$ must be injective so that $A/\mathfrak{m}_i \simeq B/\mathfrak{m'}_i$ so we have an isomorphism:
$A / (\mathfrak{m}_1 \cap \dots \cap \mathfrak{m}_n) \simeq B/(\mathfrak{m}'_1 \cap \dots \cap \mathfrak{m}'_n)$ where $f(\mathfrak{m}_1 \cap \dots \cap \mathfrak{m}_n) \subset f(\mathfrak{m}_1) \cap \dots \cap f(\mathfrak{m}_n) = \mathfrak{m}_1' \cap \dots \cap \mathfrak{m}_n'$.
Now how do I prove that that is not an isomorphism if $\subset$ can't be replaced by $=$?