how to click a html hyperlink from a java file
I am passing an html hyperlink component to a java file
<html:a href="google.com" visible="false" id="googlelink">
The visibility of this link is set to false. In the java file, when a particular condition is met, I would like to set the onclick event for this link. Meaning, when the condition is met I would like to navigate to "Google Page".
TestA.java
if (condition) {
// click the googlelink component and开发者_开发技巧 navigate to google page
}
Thanks, Sony
Assuming your TestA.java is a servlet, you can do something like this:-
response.sendRedirect("http://www.google.com");
精彩评论