A problem I had with the TV series JAG is that like every other courtroom drama on TV, all it takes is the lead to deliver an impassioned speech about justice and honour and he automatically wins the case, even in situations where the other lawyer had up until then been making more convincing arguments.
Yeah. Maybe a more realistic portrayal is in what is IMO the greatest court-martial movie (or neck-and-neck with Paths of Glory, anyway), Breaker Morant. There's an impassioned speech... but I won't spoil it.
In the first, only the prosecutor is JAG, the defence is civilian and the "judges" are regular Starfleet, the second, third and fourth appear to have no JAG involvement at all, and the last returns to the "Measure of the Man" format where only the "judge" is JAG.
At the very least, most if not all of the above examples should have included more use of enlisted legal advisors (legalman or clerks) even if the situation didn't permit the use of additional dedicated JAG officers (the DS9 examples are the only ones where the lack of additional JAG isn't explained as MoaM suggests that SB375 (Ross' command) should have had JAG personnel even if DS9 itself didn't warrant them in the early days).
In a court-martial, the court members are more like a jury, they don't need special legal knowledge. The president of the court is more like a judge. In the old days under Rocks and Shoals (the US Navy's pre-UCMJ legal code) nobody on the court had to have a legal background, but there would be a judge-advocate assigned to give the court legal advice. This can be seen in The Caine Mutiny, where the defending counsel and IIRC the prosecutor are both reservists who were lawyers in civilian life. Before 1950, the Judge Advocate General didn't even have to be a lawyer. After armed forces unification the military justice system was professionalized considerably, and Congress made JAG a Navy staff corps in 1967.
The approach the US Navy took up through the WW2 era was to send some line officers to law school after their early sea tours. They would continue in regular line officer careers but would tend to fill judge-advocate or legal type jobs in their shore/staff tours. Of course when they were serving at sea as chief engineer or assistant gunnery officer or whatever, they could also handle any legal problems that might come up. This worked in a relatively small peacetime navy. During wartime reservist civilian lawyers could be used as necessary.
In the old British Navy, the uniformed judge-advocate duties were handled by officers of the accountant branch, later called the supply and secretariat branch.