Hello there fellows,
I've been doing a JSP about a teacher, that needs to log in, and when he does and his acc is verified in a database (db4net) he stays in the JSP,
the problem is all of the data gets returned to the JSP from the database (name, last name, cellphone, sex etc.) then I made a Combo Box where it
shows the different subjects he teaches.... in this case it shows "Math 5" and "Advanced Math" .... the thing is when I try to like select a subject and run
it with a button to get it "out.print" it shows me this annoying error of "java.lang.NullPointerException", so then I worried and tried to do a simple Combo Box
and also the "java.lang.NullPointerException" error came, but anyways here's my code (sorry for spanish code, tried to
translate it a bit). I put it in color red, hope you can help new to programming
It's worth pointing out that you have essentially no JSP code in there at all. What you have is HTML with a bunch of Java code, this is very poor practice and will gain you no friends in industry if you were to write that. It saddens me that your teacher is teaching this today.
But back to you particular problem. You say you get a NullPointerException but you don't say where. Can you post the exact stack trace and indicate the line in your 'JSP' file it corresponds to?
Well, as you have found, it is annoyingly difficult to debug this kind of error in a JSP. That's only one of the reasons why people have been telling beginners not to put Java code in a JSP for more than a decade now. So I'm telling you that now. Get that code out of the JSP into a servlet for a start.
Morning came much too soon and it brought along a friend named Margarita Hangover, and a tiny ad.
Devious Experiments for a Truly Passive Greenhouse!