I am doing my first Java website, where a form in the war/MyWeb.html is managed from MyWeb.java. What I want is that, after submitting the form, a new webpage MyWeb2.html is loaded. How can I do that? I have a comment where I think this code should go... THANKS
PIECE OF MyWeb.html
<table align="center">
<tr>
<td id="fileChooserContainer" align="left"></td>
</tr>
<tr>
<td id="submitButtonContainer" align="right">&l开发者_运维技巧t;/td>
</tr>
</table>
PIECE OF MyWeb.java
public void onModuleLoad() {
final Button submitButton = new Button("Submit");
final FileUpload chooser = new FileUpload();
RootPanel.get("submitButtonContainer").add(compressButton);
RootPanel.get("fileChooserContainer").add(chooser);
class EncoderHandler implements ClickHandler, KeyUpHandler {
public void onClick(ClickEvent event) {
loadNewPage();
}
private void loadNewPage() {
// What do I have to code here to open a MyWeb2.html???
}
}
EncoderHandler handler = new EncoderHandler();
submitButton.addClickHandler(handler);
}
You can use
Window.Location.assign(url);
for this purpose.
精彩评论