-2

I am trying to achieve a Notice/Bulletin board feature where text will be updated from database which will help the users to get latest updates (similar to university websites)

1 Answers1

0

Are you asking how to display data? or how to fetch data?

To fetch data from DB:
It's very basic and simple job, just follow the flow of data carefully, Your JSP page would call a servlet, further servlet would send DB connection to java file and call one of its methods. *JSP could call servlet for specific action (loading/refresh) - or - It could be scheduled to get the latest info after a specific time interval. *

Call: -> 1.jsp -> 2.servlet -> 3.java method

java method return data (String or JSONObject(prefered for a large amount of data)), accepted by the servlet and sent further to JSP page.

Why use servlet then?
A servlet is a Java class used to help servers via request-response programming model. Example: Establish connection and send connection to java method( which execute/update query)

Return: -> 3.java method(query's result) -> 2.servlet -> 1.jsp

To display data
Just use received response with JS or JQuery to insert into your webpage view.

Links:
More about servlets: https://docs.oracle.com/javaee/5/tutorial/doc/bnafe.html
Call servlet periodically: https://stackoverflow.com/a/26437201/7190541