Pass data from servlet to jsp without forms?

前端 未结 2 1826
情书的邮戳
情书的邮戳 2020-12-21 07:44

So what I\'m basically trying to do here is get a list of hotels in JSP , from the servlet , without any forms.

This is my JSP:

<%@ page language=         


        
2条回答
  •  太阳男子
    2020-12-21 08:23

    You simply need a link to your servlet:

    Click here to list the hotels
    

    You can also invoke the servlet by typing its address in the address bar of your browser:

    http://localhost:8080/yourWebApp/yourServlet
    

    The code of your servlet is fine, and the code of the JSP as well.

    The servlet is mapped to some URL (/yourServlet in my example) thanks to a element in the web.xml, or thanks to a @WebServlet annotation on the servlet class.

提交回复
热议问题