Automatically click tag binding link on jsp page

I have one difficult requirement. I explain an example

abc.jsp calls xyj.jsp and xyj has a link , for example <a href="viewDetails.do">Click</a>

My requirement is that when I run abc.jsp , it calls xyz.jsp and without showing the xyz.jsp page, it must call the struts action. This means that I want to internally call the href of the anchor tag.

Any link or buttun should be clicked internally through javascript so that it invokes the struts action dynamically instead of go and clicks on the link manually

Thanks,

+4
source share
2 answers

My Friend You must use the jQuery Method $ ('a [href = "viewDetails.do"]'). trigger ('click'); It will do an automatic click. Thanks and let me know if you run into any problem using this. Thanks

0
source

In abc.jsp, save some flag in cookies. On xyj.jsp below the flag that was added to abc.jsp and redirected to the link, your anchor tag contains jquery.

0
source

Source: https://habr.com/ru/post/1481708/


All Articles