Html: index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Form</title>
<style>
li {list-style-type: none;}
</style>
</head>
<body>
<div>Teste</div>
<div>
<button type="button" name="showContent" id="showContent">Show page newContent.html</button>
<button type="button" name="empty" id="empty">Empty</button>
</div>
<div id="content"></div>
</body>
</html>
Html: newContent.html
New Content (Any Text)
Java: IndexController.java
@Page(name="index", path="index.html")
public class IndexController extends Window {
private final Element div = document.getElementById("content");
public void init(JRenderContext context) {
document.getElementById("showContent").addEventListener(Events.CLICK, new FunctionHandle(new SimpleFunction() {
public void init(JRenderContext context) {
div.replaceWith(AnyController.class);
}
}));
document.getElementById("empty").addEventListener(Events.CLICK, new FunctionHandle(new SimpleFunction() {
public void init(JRenderContext context) {
div.empty();
}
}));
}
}
Java: AnyController.java
@Page(name="any", path="newContent.html")
public class AnyController extends Window {
public void init(JRenderContext context) {}
}