2017  Kodetalk | Feedback | Privacy Policy | Terms | About

Required to call a servlet on load of jsp page

I have a Servlet GetCountryServlet which has record of List<Country>.

And I want to call this servlet at the time of loading of my jsp page which will display a country drop down.

But I don"t want to display the name of servlet in url. Is there any way by which I can do this.


You have so many option to complete you activity like,

<jsp:include page="/getCountryServlet "/>


response.sendRedirect(request.getContextPath()+"/getCountryServlet ");


Call a servlet instead get result in request attribute and forward the request to jsp

or make an ajax call to servlet on load and render the response using javascript

Answer is