开发者

How to call a Servlet when I click on a Hyperlink

开发者 https://www.devze.com 2023-01-17 05:54 出处:网络
On a JSP Page I have populated a table with some id\'s. I have made these ID\'s as hyperl开发者_如何学编程ink. Now i want that if I click on any id it should go to a servlet and that particular id sho

On a JSP Page I have populated a table with some id's. I have made these ID's as hyperl开发者_如何学编程ink. Now i want that if I click on any id it should go to a servlet and that particular id should also be passed to the servlet.


Use this code in your JSP:

  <a href="<%=request.getContextPath() %>/servlet-url?id=<%=id %>">...</a>

to create a link which invokes the servlet at /servlet-url and passes the ID in the request parameter id.

0

精彩评论

暂无评论...
验证码 换一张
取 消