我正在使用Meteor js开发一个演示网站。我想点击一个按钮直接转到另一个页面。但在此之后,新页面需要自动重新加载。逻辑是这样的:
import java.io.IOException;
import java.util.Date;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
public class Test {
public static void main(String[] args) throws IOException {
String classFilePath = "/com/mysql/jdbc/AuthenticationPlugin.class";
String jarFilePath = "D:/jars/mysql-connector-java-5.1.34.jar";
Test test=new Test();
Date date = test.getLastUpdatedTime(jarFilePath, classFilePath);
System.out.println("getLastModificationDate returned: " + date);
}
/**
* Returns last update time of a class file inside a jar file
* @param jarFilePath - path of jar file
* @param classFilePath - path of class file inside the jar file with leading slash
* @return
*/
public Date getLastUpdatedTime(String jarFilePath, String classFilePath) {
JarFile jar = null;
try {
jar = new JarFile(jarFilePath);
Enumeration<JarEntry> enumEntries = jar.entries();
while (enumEntries.hasMoreElements()) {
JarEntry file = (JarEntry) enumEntries.nextElement();
if (file.getName().equals(classFilePath.substring(1))) {
long time=file.getTime();
return time==-1?null: new Date(time);
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (jar != null) {
try {
jar.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return null;
}
}
我想我可以在某个地方使用Template.reload.events({
'click #mybutton': function(){
var index = ...//randomly generate an index;
Router.go('/'+index);//I have Router.route("/:index" ) in router.js
//I want to reload the new page after the going to a new page
}
,但我不知道该把它放在哪里。有什么建议?感谢
答案 0 :(得分:1)
请试试这个 您可以使用Location.reload()方法。
Template.reload.events({
'click #mybutton': function(){
var index = ...//randomly generate an index;
Router.go('/'+index);//I have Router.route("/:index" ) in router.js
document.location.reload(true);
}