I have the following method in my Servlet.
private String process(HttpServletRequest arg0, HttpServletResponse arg1) {
return ("a key");
}
protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
process(arg0, arg1);
}
In web.xml the following code is added
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>iusa.ubicacel.actions.map.MyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/MyServlet</url-pattern>
</servlet-mapping>
In inicio.jsp the following is added
<script type="text/javascript" src="<%=request.getContextPath()%>/MyServlet"></script>
In the src tag above I want to add google map api url(which I will retrieve from the database in the servlet) from the process method in the MyServlet.I understand from the comments that my approach is wrong.Can anyone please tell me how to do it correctly with only this jsp and servlet.