简体   繁体   中英

pass variable value by clicking mouse to the servlet in java

I have one java server page in which values are returning from database and using bean concept and on jsp page i have used c:for each loop so i am able to get the answer so i have made one particular column as link using like this

<td><a href = retrieve_image>${item.getIid()}</a></td>   

this code is working what i want when i click mouse on this id then this id value should pass into that servlet retrieve_image, so i can perform my task so anyone please tell me is this possible?

Simple you could pass the value inside your <a> like this as query string,

<td><a href = "retrieve_image?Id=${item.getIid()}">${item.getIid()}</a></td> 

Get the value from the Id in your servlet . you will get the value for current iteration inside the for-each loop as you print ${item.getIid()}

Hope this helps !!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM