Forums Register Login

JSP to Database linking

+Pie Number of slices to send: Send
I've been thinking of creating a basic message board. I figure the best way to go about this is to use jsp, servlets and a database on the backend. To create new messages, I would imagine the way to go about this is to use an html form and then have the servlet enter it into the database. My question is this: after I display the topics from the database, how do I link the posted messages to the database? I can't use a simple <a href tag right?
Any input would be appreciated. ( I wasn't sure if this should go here or in jdbc)
- Sean
+Pie Number of slices to send: Send
Check out the Jive message board. It is opensource, so you can look at the source code:
http://www.jivesoftware.com/
Julia
+Pie Number of slices to send: Send
Hi,
Thanks for the reply. I had already checked out jive, it is very impressive. But it's tough to wade through all the source code and identifying what I'm looking for. My question is a lot simpler: How would I put a link on a jsp page that retrieves the contents from a record in a database?
+Pie Number of slices to send: Send
Okay I've been thinking about this some more. If I had a subject in a forum entitled:
Java
How would I link to a database that contains a record of the contents of that post? Should I link that topic to a servlet and have the servlet retrieve the record and then display it in a page? Is this the right approach? Any thoughts would be appreciated.
Thanks,
Sean
+Pie Number of slices to send: Send
I think a better approach is to build a class that is a pool of connections than you should build a Java Bean to store the resultSets and do a class to connect to the DB using your connection pool and store the results in the bean and then u can easily show this results using a jsp page, and your servlet will be used only like a controller to these actions.
+Pie Number of slices to send: Send
I've been reading up on this, and I fully agree with you. I think I should use the Jsp as the view, servlet as the controller and the beans as the model. However, I still don't understand how to display the messages.

Thanks for your reply,

Sean
I knew that guy would be trouble! Thanks tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 847 times.
Similar Threads
Proper mix of Servlets and JSP
Consuming JMS messages in FIFO order
minor design question
Initialising Database connections with JSP
A bean to store a file?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 00:06:22.