Is every commutative ring without non trivial idempotent ,local? I know that every local ring doesn't contain nontrivial idempotent because the number of maximal ideals in R is equal to the sum of maximals in S and T where R=ST. I thought since the ring doesn't contain nontrivial idempotent it can not be the direct product of two rings and each factor contains a maximal ideal so perhaps there us just one...
No, for example any non-local domain is a counterexample.
For a non-domain example, an interesting one is $\mathbb Z[x]/(x^2-1)$ lacks nontrivial idempotents, but has distinct maximal ideals.
You can find this and several more examples using this search at DaRT.