所以我之前已成功获得ajax请求,但我总是不得不使用表单,然后在提交结束时返回false,以便它不刷新页面.
我最近刚刚将我的javascript移动到一个单独的文件中,这导致我的@命令失败.因此,我不知道如何将我的网址设置为我的路线?
HTML:
<button id="saveAsDefaultButton">Save as default</button>
Run Code Online (Sandbox Code Playgroud)
Playframework java代码:
public static Result saveDefaultPhoneForUser(String handset) {
User currentUser = User.findByName(session("name"));
currentUser.lastControlledHandset = theHandset;
currentUser.save();
return ok();
}
Run Code Online (Sandbox Code Playgroud)
路线:
POST / controllers.Application.saveDefaultPhoneForUser(handset : String)
Run Code Online (Sandbox Code Playgroud)
JavaScript的:
$('#saveAsDefaultButton').click(function(evt) {
$('#errors').hide();
$.ajax({
type : 'POST',
url : "controllers.Application.saveDefaultPhoneForUser",
data : $('#controlledPhone option:selected').text(),
dataType : "text",
success : function(data) {
//setError('Call succedded');
//$('#test1').attr("src", data)
},
error : function(data) {
setError('Make call failed');
}
});
return false;
});
Run Code Online (Sandbox Code Playgroud)
我确定有办法做到这一点我只是没有运气找到任何东西.任何帮助都很大的帮助.
我在http://shootout.alioth.debian.org/中看到了Java -server 用于编程语言基准测试.我知道-server是运行JVM的参数.我想知道:
当我们使用-server参数时它是如何工作的?我们可以将此参数用于java桌面应用程序吗?
谢谢.
我正在使用最新稳定的Spring版本(4.2.6.RELEASE).
将Hibernate从5.1升级到5.2并将hibernate-entitymanager依赖关系更改为正确的hibernate-corehibernate文档后:https://github.com/hibernate/hibernate-orm/wiki/Migration-Guide---5.2
我没有收到任何编译错误,但我的所有测试都失败了这个堆栈跟踪:
Jun 06, 2016 12:00:38 PM org.springframework.test.context.TestContextManager beforeTestMethod
WARNING: Caught exception while allowing TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener@548b7f67] to process 'before' execution of test method [public void com.rh.cores.architecture.tests.units.person.PersonTest.add_iranianNaturalPersonDateIsInvalid_preventSaving()] for test instance [com.rh.cores.architecture.tests.units.person.PersonTest@7f9e8421]
org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is java.lang.NoSuchMethodError: org.hibernate.Session.getFlushMode()Lorg/hibernate/FlushMode;
at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:431)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
at org.springframework.test.context.transaction.TransactionContext.startTransaction(TransactionContext.java:98)
at org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethod(TransactionalTestExecutionListener.java:200)
at org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:265)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:254)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at …Run Code Online (Sandbox Code Playgroud) 我正在使用声纳,我已经得到了这种违反我的代码的和平:
Correctness - Possible null pointer dereference
Run Code Online (Sandbox Code Playgroud)
在findbugs有没有人知道这个规则?我搜索了很多,但是我找不到描述这条规则的好的示例代码(用Java),遗憾的是findbugs网站没有关于这条规则的任何示例代码或良好的描述.
为什么会出现此违规行为?
如何在日志中显示SQL语句?我正在使用EBeans,但由于某些原因它无法插入,但我看不出有什么问题.
我尝试将配置编辑为:
db.default.logStatements=true
Run Code Online (Sandbox Code Playgroud)
并将其添加到logback.xml
<logger name="com.jolbox" level="DEBUG" />
Run Code Online (Sandbox Code Playgroud)
按照我在网上找到的一些答案,但它似乎不适用于2.4 ......
我对Go编程语言知之甚少,但我看到有几个声称Go表示没有延迟的垃圾收集,它比其他垃圾收集器(如JVM垃圾收集器)要好得多.我已经开发了JVM应用程序,我知道JVM垃圾收集器不是无延迟的(特别是在大内存使用中).
我想知道,Go中的垃圾收集方法与其他使其无延迟的方法有什么区别?
提前致谢.
编辑:@All我完全编辑了这个问题,如果你觉得它有建设性,请投票重新打开这个问题.
我正在开发一个大项目,我写了很多GWT代码.现在我正致力于使该项目与iPad和Android平板电脑等平板电脑完全兼容.
作为其中的一部分,我注意到触摸设备需要300毫秒的延迟来处理点击事件.在这个项目中,再次编写触摸事件是一项非常繁琐的任务.我已经做了很多研究,发现了Google Voice Application中使用的Google Fast Buttons API.我试过它并且它的工作正常,但需要大量的编码和JSNI.
我的问题是,你知道还有其他什么可以轻易克服这种延迟吗?
我们在Play Framework,Silhouette和Deadbolt 2中有两个着名的身份验证和授权插件.我的问题是这两个插件有什么区别?在什么情况下我们应该使用Silhouette或Deadbolt 2?
当我在Sonar中遇到违规(违反钻取标签)时,在源代码视图中Sonar有一些动作,如评论,分配等,其中一个是假阳性,我想知道这个操作的确切含义是什么,什么时候应该使用它?
我想在Play Framework 2.4中使用getInstanceGuice Injector类的方法,我该如何访问它?
我已经使用Guice FactoryModuleBuilder实现了一个在运行时返回另一个工厂的工厂!在返回工厂的第二级,我需要访问Play Guice Injector以使用反射而不是@Inject注释来手动获取对象.