Forums Register Login

Data from database on the index page

+Pie Number of slices to send: Send
Hello.

I'm wondering how to put data on the index page. I'm using hibernate. Servlet should take data from database and dispatch it to the index.jsp with request.
If I would have a static index page (without any data from database) user would type www.example.com or www.example.com/index.jsp . Index. jsp is in DD in welcome-file-list and everything should work fine right? If I want to have a dynamic data in my index.jsp I have to call servlet first, but when user makes request for www.example.com, he makes request for index.jsp, servlet is not called so it won't get and dispatch data to the index.jsp.
I have one solution for this problem, but I'm not sure is it correct. Do I have to put "MyServlet.do" in my welcome-file-list instead of index.jsp ? I think there must be other solution. I saw many jsp/servlet based sites which have dynamic data in theirs index.jsp. Of course they could map the servlet as "index.jsp" but I don't belive in this really.

best regards

MK
+Pie Number of slices to send: Send
Make the welcome page the servlet, not the JSP.
What are you saying? I thought you said that Santa gave you that. And this 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 1244 times.
Similar Threads
How to call a servlet doGet or doPost method inside a JSP page on page load
Servlet Mapping
make servlet the default "welcome" file for the web app
Ejb 3.0 Unable to run the program in Weblogic or Glassfish server
Calling servlet on page load
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:10:38.