Commutative rings whose non-trivial ideals are maximal It is well known that a local ring is a ring containing only one maximal ideal. I was wondering if there is a characterization (or any information) of the commutative rings such that all their non-trivial ideals are maximal.
Thanks.
 A: One way to characterize a ring $R$ whose nontrivial ideals are maximal is this way:

$R$ is a ring with finite composition length and that length is at most 2.

Another obvious way is

$R$ is a ring in which the maximal and minimal ideals coincide.

In particular, $R$ is a "very small" Artinian ring.
In the case they have composition length 1, you have a field. An easy example of a nonfield ring of composition length 2 is $F[x]/(x^2)$ for a field $F$. Yet another example is $F\times K$ for two fields $F,K$.
An interesting way to analyze the nonfield case was brought up by Prism in the comments: if $Nil(R)\neq 0$, then since $R$ is Artinian, $Nil(R)=J(R)$ is the unique minimal and unique maximal ideal of $R$.
If $Nil(R)=\{0\}$ then we have a commutative semisimple Artinian ring, i.e. a finite product of fields. It's easy to see that $R$ would have to be a product of exactly two fields, $F$ and $K$, so that $F\times K$ would have exactly these nontrivial ideals: $F\times\{0\}$ and $\{0\}\times K$.
So a good third thing to add to our list would be:

$R$ is a field, a product of two fields, or else is a uniserial ring with exactly one nontrivial ideal.


If you are curious about noncommutative rings as well (and we talk about all nontrival right ideals being maximal), then $M_2(F_2)$, the $2\times 2$ matrix ring over the field of $2$ elements is an easy example of a (noncommutative) ring with composition length 2.

About saying "the opposite of a local ring." I think a much more natural candidate for the "opposite" of a local ring is a ring which has a unique minimal ideal. Among commutative rings, these are exactly the subdirectly irreducible rings. 
There is an interesting connection when the conditions are combined and the descending chain condition is thrown in: For a commutative local artinian ring $R$,  $R$ has a unique minimal ideal iff its ideals form a chain.
A: In any ring $R$, $R$ itself is a nonmaximal ideal. Assuming you meant to exclude that case: if every ideal of $R$ is maximal, then in particular $\{0\}$ is a maximal ideal, and so $R$ is a field.
