I have created a new AjaxLink in my .java file
add(new AjaxLink("link"){
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
target.appendJavascript("window.open('http://www.cnn.com/2011/WORLD/africa/02/23/libya.protests/index.html?hpt="+T1+"')");
}
});
And added it to my .html file
<a href="#" wicket:id="link">TEXT TO REPLACE</a>
The url is just an example but T1 is dynamic and I get that from my .java file. I would like the “TEXT TO REPLACE” to equal the T1 string but I don’t know how to do this. I have tried creating a Label and adding it like
<a href="#" wicket:id="link"><span wicket:id="linkLbl"></span></a>
but that gives an error.
Any suggestions?
Thanks
The
Labelis the right direction, but you have to make sure that you add the label in the java code as well, it should be a child component of your ajax link.(On a sidenote: you might want to consider using
<wicket:container>instead of<span>. In this case it doesn’t matter much, but there are cases where an extra<span>tag would make your HTML invalid.)