Questions tagged [playframework-2.0]

Play Framework 2.0 is a major revision of Play, a Ruby on Rails-like framework for the Java platform. Version 2.0 introduces features such as the use of Scala language, Akka actors, Scala templates and a build system (SBT).

Play is based on a lightweight, stateless, web-friendly architecture and features predictable and minimal resource consumption (CPU, memory, threads) for highly-scalable applications - thanks to its reactive model, based on Iteratee I/O.

Play Framework 2 Stack Overflow Tutorial

  1. Controllers and routes
  2. Models and business layer
  3. Views
  4. i18n
  5. Persistence
  6. IDE support
  7. Deployment
  8. Using SBT
  9. Actors and asynchronous programming
  10. Extension points
  11. Scheduling
6980 questions
210
votes
23 answers

How do I change the default port (9000) that Play uses when I execute the "run" command?

How can I change the default port used by the play framework in development mode when issueing the "run" command on the play console. This is for playframework 2.0 beta. Using the http.port configuration parameter either on the command line or in…
Boris Terzic
  • 10,482
  • 8
  • 42
  • 58
125
votes
5 answers

How to avoid passing parameters everywhere in play2?

In play1, I usually get all data in actions, use them directly in views. Since we don't need to explicitly declare parameters in view, this is very easy. But in play2, I found we have to declare all the parameters(including request) in the head of…
Freewind
  • 177,284
  • 143
  • 381
  • 649
91
votes
10 answers

Steps needed to use MySQL database with Play framework 2.0

I'm new to Play framework. I'm trying to configure MySQL database as a datasource to be used with Play Ebeans. Could you some one please explain the steps that are needed to configure MySQL with Play 2.0 framework (like, downloading drivers, adding…
Veera
  • 29,772
  • 35
  • 94
  • 133
89
votes
2 answers

scala slick method I can not understand so far

I try to understand some Slick works and what it requires. Here it an example: package models case class Bar(id: Option[Int] = None, name: String) object Bars extends Table[Bar]("bar") { def id = column[Int]("id", O.PrimaryKey, O.AutoInc) //…
ses
  • 12,339
  • 25
  • 106
  • 203
86
votes
9 answers

NoSuchMethodError in javax.persistence.Table.indexes()[Ljavax/persistence/Index

I have a Play Framework application and I was using Hibernate 4.2.5.Final (which is retrieved via the Maven dependency manager). I decided to upgrade to Hibernate 4.3.0.Final, recompile my application successfully, and ran it. I got the exception…
musubi
  • 1,227
  • 3
  • 13
  • 21
83
votes
14 answers

Access Play! 2.0 configuration variables in application.conf?

Previously in Play! v1 it was really easy to define configuration variables in application.conf and then access them like so: play.configuration("db.driver") However now I can't find anything in the documentation for similar uses in v2 or a proper…
crockpotveggies
  • 11,654
  • 11
  • 65
  • 127
73
votes
6 answers

How to handle optional query parameters in Play framework

Lets say I have an already functioning Play 2.0 framework based application in Scala that serves a URL such as: http://localhost:9000/birthdays which responds with a listing of all known birthdays I now want to enhance this by adding the ability to…
magicduncan
  • 1,376
  • 1
  • 10
  • 11
62
votes
13 answers

Accessing the application.conf properties from java class with Play! 2.0

I want to add an object to the Global scope, and in order to construct it I need to pass it a path to a file. I don't want to hard code the file path in the source, and so I want to get that path from the application.conf. The problem is that I…
Nitzan Tomer
  • 120,901
  • 33
  • 273
  • 264
62
votes
4 answers

How to write database-agnostic Play application and perform first-time database initialization?

I'm using Slick with a Play Framework 2.1 and I have some troubles. Given the following entity... package models import scala.slick.driver.PostgresDriver.simple._ case class Account(id: Option[Long], email: String, password: String) object…
j3d
  • 8,708
  • 17
  • 76
  • 150
60
votes
5 answers

Play 2.x: How to make an AJAX request with a common button

So I have successfully gotten AJAX requests to work before but I have always had to use a form, and then at the end of the submit do return false so that it doesn't refresh the page. I have also just recently moved my JavaScript into a separate file…
user1434177
  • 1,917
  • 3
  • 25
  • 39
57
votes
8 answers

Declare variable in a Play2 scala template

How do you declare and initialize a variable to be used locally in a Play2 Scala template? I have this: @var title : String = "Home" declared at the top of the template, but it gives me this error: illegal start of simple expression…
travega
  • 7,962
  • 16
  • 58
  • 89
53
votes
6 answers

What are the major differences between Play Framework 1.0 and 2.0?

With the recent release of Play Framework 2.0, I would like to know if anyone could summarize ,from a high level standpoint, the major differences between Play Framework 1 & 2. I already compiled a few (play 1.0 -> play 2.0): Template engine:…
Olivier Refalo
  • 46,213
  • 20
  • 84
  • 114
50
votes
2 answers

Play Framework 2.1 - Cannot find an implicit ExecutionContext

I am calling a webservice like this: WS .url(url) .get .map { response => // error occurs on this line response.status match { case 200 => Right(response.json) case status => Left(s"Problem accessing api, status '$status'") …
EECOLOR
  • 11,034
  • 3
  • 38
  • 72
47
votes
2 answers

Comparing Lift with Play2

I used play2 before with java. It felt a little bit like boilerplate especially if you used akka with java. But that is not the fault of the framework. Yesterday I read "Scala for the impatient" and I really enjoy the language. Now I looked at both…
Maik Klein
  • 13,812
  • 20
  • 88
  • 168
44
votes
1 answer

How to declare a variable named 'type' in Play/Scala?

I want to declare a variable with name 'type' in a Play/Scala application, since my data has this field name and I'm using JSON transforms. It just makes more sense. Fortunately I could just rename the field, but still curious if there is a way to…
jmend
  • 1,130
  • 3
  • 15
  • 30
1
2 3
99 100