This is actually a difficult question. Many scholars of the war consider him over-rated, along with most of Jeff Davis’ friends. At the same time, he was faced with a truly awful position and had to deal with deep incompetence among his subordinates. To sum up:
*He had a truly vast military theater, but he lacked the troops even to guard it.
*The mistakes of Pope in Kentucky turned that state against him, and he had to deal with the Mississippi flanking his left position. Fortunately Thomas could never manage an advance (his career in a nutshell) securing the right flank, but Johnston didn’t know that.
*Mistakes in the initial siting of forts Henry and Donelson would make them untenable, although this was not recognized at the time. Later on, what should have been strong positions blocking a Union advance fell far too easily.
As a result, Johnston was, or critically, should have been, in an impossible position flanked on left and right and facing a superior force in the center. He had no choice but to retreat from Nashville, gather his forces, and attack desperately. In truth, his position was not quite as bad as it seemed largely because Gen. Henry Halleck was effectively hamstringing the Union cause. Still, he was badly outnumbered and the Confederacy needed to buy time desperately.
In that sense, gambling everything at Shiloh was more than reasonable, and in the event it worked fairly well. Had almost any other general other than Grant been in charge of the Union forces, the result probably would have been a half-panicked retreat. (Although, to be fair, had almost any other general other than Sherman happened to have been on the front there probably would also have been no surprise.)
Additionally, while Johnston has often been criticized for his actions during the battle, and he did act more as a martial cheerleader rallying troops and pushing them forward than a battle commander, he did this deliberately knowing his strengths. Instead of leaving control of the battle in the air, he made sure that it was in the capable hands of Gen. Buckner - who did in fact make numerous on-the-fly decisions and effectively controlled the tactical picture that first day. It is true the Confederates were unable to win, but they inflicted a great deal of damage on the attack.
Moreover, in defeat they achieved much of the strategic goal anyhow. Halleck, already nervous, took command personally and more or less halted the Union war effort in the West until he could inch his way to Corinth. He then broke up his army and distributed it poorly, delaying a unified western command through most of 1862. Shiloh therefore bought the Confederacy an entire year before the Union was able to really advance further.