playframework-2.0

How solve error reading annotations in play framework 2

放肆的年华 提交于 2019-12-23 03:32:25
问题 this is my proyect link https://github.com/jstar88/LibreTitan i got this exceptions compiling in localhost: play framework 2.1 Unexpected exception RuntimeException: Error reading annotations for models.User No source available, here is the exception stack trace: ->java.lang.RuntimeException: Error reading annotations for models.User com.avaje.ebeaninternal.server.deploy.parse.ReadAnnotations.readAssociations(ReadAnnotations.java:54) com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager

Uncaught ReferenceError: $ is not defined (using play framework)

随声附和 提交于 2019-12-23 03:12:54
问题 I am new to Play Framework and I'm reading a book called "Play for java" , I'm also programming everything alongside the book. you can find the complete source code here. I want to add a delete functionality for every product in a list. according to the book , here are my different parts of the code: here is my controller: package controllers; import models.Product; import play.data.Form; import play.mvc.Result; import play.mvc.Controller; import views.html.products.*; import java.util.List;

Ad-Hoc Validation is not executed

放肆的年华 提交于 2019-12-23 03:09:45
问题 I have a simple entity called Game . I want to allow my users to edit multiple of these entities at once. Therefore I need a form that contains multiple Game Entities. The problem: When the form is submitted and I invoke hasErrors() my custom ad-hoc validate method in the Game entities is never called. Only the validations marked by annotations are checked and produce errors when they are invalid. This is the Game Entity: @Entity public class Game extends Model { @Id public Long id;

how to render arraylist or list and to handle it in template play framework 2.x

孤者浪人 提交于 2019-12-23 02:59:10
问题 I was familiar with Play 1.x . But I had to use cassandra DB. That is why I had to use Play 2.x However Scala mixing everything really. Template is very different in Play 2.x For example, in Play 1.x I just could send any parameter as String , int , object instance, arraylist etc. In render to the view template and could use these paramaters easly in template. I dont know how to succed this in Play 2.x there is only a render and it just enable me to render a String . I read something about

Play Framework: Chain ActionsBuilder and ActionRefiner

我的梦境 提交于 2019-12-23 02:51:40
问题 I am desperate. I tried to do ActionComposition like in the very last paragraph of the official docs: https://playframework.com/documentation/2.3.x/ScalaActionsComposition My code: object ActionBuilder1 extends ActionRefiner[Request, Request] { override protected def refine[A](request: Request[A]): Future[Either[Result, Request[A]]] = Future {Right(request)} } object ActionBuilder2 extends ActionBuilder[Request] { def invokeBlock[A](request: Request[A], block: (Request[A]) => Future[Result])

(playframework 2.0.2-java) EBean - No ScalarType registered error when querying with enum values

人走茶凉 提交于 2019-12-23 02:44:24
问题 I have Role entity class: @Entity public class Role extends Model { @Id @Constraints.Required public Integer id; @Constraints.Required @Formats.NonEmpty @Enumerated(EnumType.STRING) public RoleNameEnum name; // name is enum value } In some test I try to find users by role: List<User> users = User.findByRole(Role.findByRoleName(RoleNameEnum.ADMIN)); where method findByRoleName() is following: public static List<User> findByRole(Role role) { return find.where().eq("role", role).findList(); } I

play framework - SQLite: Enable Foreign Key

不打扰是莪最后的温柔 提交于 2019-12-23 02:19:43
问题 I have a problem when using SQLite with play, SQLite documentation says that foreign keys are disabled by default, and need to be enabled with each connection. I am using SQLite with Ebean, in evolution I added this line: PRAGMA foreign_keys = ON; but It doesn't work, it only works when I open a connection from terminal or SQLite Client and execute that line ( PRAGMA foreign_keys = ON; ), I also tried this in the start of the app but with no luck: Ebean.getServer("mom").createSqlUpdate(

Trying to include GSON in Play! 2.0 project

时光怂恿深爱的人放手 提交于 2019-12-23 01:36:10
问题 I've added "com.google.gson" % "gson" % "2.2" to my AppDependencies but when I run play update, I get: [info] Updating {file:/Users/levinotik/Dev/scala/throw-away/myFirstApp/}myFirstApp... [warn] module not found: com.google.gson#gson;2.1.0 [warn] ==== local: tried [warn] /Users/levinotik/dev/scala/play-2.0.4/framework/../repository/local/com.google.gson/gson/2.1.0/ivys/ivy.xml [warn] ==== Typesafe Releases Repository: tried [warn] http://repo.typesafe.com/typesafe/releases/com/google/gson

Routing in Java Play Framework 2, List<> as parameter

只愿长相守 提交于 2019-12-23 00:27:10
问题 I'm trying to send a List of Infoobjects to my controller. I need to specify the routes file. I know how to send int,string and long as parameters, but how about a List<>? I have tried with this, but it's not working and i'll get an error message saying " not found: type Infoobject ". GET /generateExcel controllers.Application.generateExcel(list:List[Infoobject]) Thanks! 回答1: First of all, I think you need to put the package of your object in the [] of the list : List[path.of.your.package

Import npm node_modules' css into Play Framework 2.4 app

感情迁移 提交于 2019-12-22 22:49:11
问题 I am trying several approaches to using Browserify with my play framework app, one of them is to use npm as package manager. A few modules are installed, and the typical node_modules folder appears at the root of the project. Using Browserify and Gulp, I was able to 'require' the Javascript from such modules and use it (take Bootstrap, for example). However, loading the CSS (e.g. for Bootstrap) I tried different things none of which would work. First, I tried to make it work in a plain HTML