playframework-2.0

Could not open the editor: Editor could not be initialized. NoClassDefFoundError

为君一笑 提交于 2019-12-24 14:26:04
问题 I can import the Play2 project in eclipse, and work on scala files, but the problem is I can't open view files likes 'index.scala.html'. When I try to open the file I get following error. Could not open the editor: Editor could not be initialized. java.lang.NoClassDefFoundError: scala/util/parsing/input/Positional at org.scalaide.play2.templateeditor.lexical.TemplatePartitionTokeniser.getScalaCommentAndPlainRegions(TemplatePartitionTokeniser.scala:28) at org.scalaide.play2.templateeditor

create scala.html files in play 2 framework [closed]

和自甴很熟 提交于 2019-12-24 14:04:11
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 7 years ago . hope to explain my problem better now , I am using play 2 framework with java to develop a sketching system with html5 canvas. the front end will be

How to bind form field to an object in Play 2 Framework

谁说我不能喝 提交于 2019-12-24 13:58:01
问题 I've been having trouble getting my Form bindings to work properly(basically Trial and Error). In Play 2.0.3 (Java) What is the proper way to bind a Form to a Model which is composed of other objects ? I cooked up this little example to try and understand it better. But even this basic example seems to have issues. The Simple class which I'm trying to bind the Form to has 3 fields a plain String Field,A List of Strings and a custom field which is just a wrapper around a string. On submitting

Scala Play framework URL in iframe is not working

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 12:17:50
问题 I want to display this iframe in my scala play view; <iframe src="http://localhost:9020/index.html#/group/sectiona/sectionb">Loading...</iframe> If I hard code this url, it works. But I want it to be dynamic. I tried; <iframe src="http://localhost:9020/index.html#/group/{{ 'http:\//localhost:9020\/#\/group\/' + myclass.section + '\/' + myclassb.section }}/testtopic">Loading...</iframe> <iframe src="http://localhost:9020/index.html#/group/{{myclass.section}}/sectionb">Loading...</iframe>

Scala dynamic datatype and operators

爱⌒轻易说出口 提交于 2019-12-24 11:29:24
问题 I have a json which will send me 3 fields. attribute operator value for example: attribute:total operator: >= value:1000 In scala I want to compare that field_name value, against that condition_value, according to that operator if($cart[$field_name][$operator][$condition_value]) //means if(cart['total']>=100) return true else return false Operators will be dynamic. Datatype of values will be dynamic, for example condition_value can be string or number. Can I achieve it in scala / play

Play 2.5.x junit test error handling with fakeRequest

本秂侑毒 提交于 2019-12-24 10:58:54
问题 My program uses global error handling. When i using fakeRequest() to test, it throws out exception instead of trigger my error handler. Am I missing some configuration? Or how can I test my global error handler. Below is my current code: Controller: public class MyController { public Result MyService() { if (true) throw new RuntimeException("exception"); } } ErrorHandler: @Singleton public class MyErrorHandler extends DefaultHttpErrorHandler { @Inject public MyErrorHandler (Configuration

Scala Slick implicit conversion of multiple types in raw SQL query

谁说我不能喝 提交于 2019-12-24 10:57:39
问题 I'm working on a Scala Play Framework 2.2 project, and I'm using play-slick 0.5.0.8 as my DB access layer. I have the following code in one of my DAO objects: def randomByBlahAndDate(blah: Blah, newerThan: LocalDate)(implicit s: Session): Option[Photo] = { sql"select * from photos where blah = $blah and imgDate > $newerThan order by rand()".as[Photo].headOption } As you can see, it does some tricky stuff like ordering by rand(), which is why I decided to go the raw SQL route. In any case, I

Present JSON data to a play framework template

痴心易碎 提交于 2019-12-24 10:48:15
问题 Trying to get it to work without any detail knowledge of JQuery. I am really having a hard time finding an comprehensible example of how i would create an unnumbered list out of some json that i am passing to the front inside a String object. I am using the Play! Framework. My Application has a method that returns a string holding an json array of items. GET /items controllers.Application.items() the method looks like this: public static Result items() { return ok(Json.toJson(Item.all())); }

How do we call “Caching in Template” for Play 2.1?

大兔子大兔子 提交于 2019-12-24 10:47:17
问题 We are trying to follow the "Caching in templates" example listed in http://www.playframework.com/documentation/2.1.1/JavaCache and the compiler throws us an " not enough arguments for method getOrElse " exception message. Our code in the template: @play.cache.Cache.getOrElse("cached-content", 3600){ test } So we decided to dig the API and apparently we still short of java.util.concurrent.Callable parameter. Does anyone know what should we pass in for that parameter? Thanks Play 2.1.1 Javadoc

playframework random CRUD error

点点圈 提交于 2019-12-24 08:14:31
问题 when i execute the below controller action I get the error attached at end of this question. when getting this error and if i refresh the page in browser the controller view page displays with no error. i'm not sure what causes this error at first request of beleow controller action? /** * controller to register new user. * Shows registration screen. */ public static void registration() throws Exception { ObjectType type = ObjectType.forClass("models.User"); Constructor<?> constructor = type