Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp and oracle  RSS feed

 
Bob Rocks
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I am working on a jsp app for work and have been told there are better ways to do what I have been doing. I would like a quick example of a page that connects to an oracle db with jdbc and allows a user to enter data into text boxes and update the database. Also, the proper way to select data using prepared statements. Prepared statements are pretty new to me and I need some info, I will be looking into them, but for now I would like to see some sample code.

thanks
-Bob
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Best practice is to not perform database operations on the JSP itself. Such operations should be relegated to back-end code. You can refer to topics like "MVC" and "Model 2" to find out more about this pattern.

With regards to PreparedStatements, they are a good and useful thing. Find yourself a good JDBC tutorial for the basics. And then feel free to post in our JDBC forum with specific questions that you might have.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch!
 
Bob Rocks
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great I will check into your suggestions!

And thank you for your kind welcome!

-Bob
 
Archanaa Panchal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bob,

you might try to create a default format to display your results, pass the results of your PreparedStatement to a collection and then use this collection to set up display in a JSP. this will let you put your results in a standard format if you need.

thanks,

archie
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!