I need your help, I just really don't know how to connect my jsp into mysql.., I tried this code:
I get this code from my connection when using java alone. Also I saw this code in net and I just revise it. I dont know if it connects to the mysql.. when I try to run it theres nothing on the screen like Successfully connected or error message.
One more sir, is JSP similar to HTML but it is run under JVM?
No, JSP produces HTML. To understand what JSP is, please read this article.
chure abcede wrote:Now im confused again, so what should I code in JSP?
Nothing. Putting Java code into a JSP has been obsolete for 12 years. Please see this JspFaq entry.
and where should my code like db connection and methods be placed ?
In the model classes. Please see this article for information on properly structuring web applications.
I sounds as if you need to read some books or tutorials to understand the basics of programming web applications. Be sure that the JSP resource focuses on JSTL and EL, and not on obsolete Java scriptlets.
I don't yet have over view in website development, i just started in web application from desktop application. Do you have any recommended books or pdf file that should I read that is best suited for beginners because some of the tutorials are advance?
chure abcede wrote:I don't yet have over view in website development, i just started in web application from desktop application. Do you have any recommended books or pdf file that should I read that is best suited for beginners because some of the tutorials are advance?
Head First Servlets and JSP is often recommended. (Disclaimer: I was a tech reviewer of this book.)
Thanks for the help sir, I already tried using a .java file into a jsp and it works well. But I have a little problem,I want to print a message in the html like hellow world but it only printed in the console of eclipse since im using S.O.P.
I tried to use the servlet but i'm having an error. java.lang.NullPointerException
Stop putting Java code in your JSP. Even if you can get it to work, it's a poor and obsolete practice.
Of course you can't just plop a method into servlet -- or any other class -- and call it from a JSP expecting it to magically have a response. That's not how servlets work.
This is the sort of dangerous thinking that putting Java code into a JSP results in.
Again, I think you are in a deep hole and digging yourself deeper. You need to back up a bit and understand some of the fundamentals of how the web works before diving off into whatever it is you are doing.