How can I access the value application.name
from conf/application.conf
in a view?
标签:
playframework
相关问题
- PlayFramework: how to transform each element of a
- Could not import the newly generated play framewor
- Play Framework Unicode symbols in HTTP Header
- Putting output of 'git describe' in templa
- org.scala-sbt#sbt;${{sbt.version}}: not found on e
相关文章
- Testing request with CSRF Token in Play framework
- How to map an abstract collection with jpa?
- play2 framework my template is not seen. : package
- How does @Inject in Scala work
- play framework 2.0 - unexpected exception - Key No
- Error integration fingerprint U.are.U SDK with jav
- Custom bridge table in playframework ebean
- how to handle fileupload into a table in play fram
Update for Play 2.5.x
In Play Scala 2.5.x, method current in object Play is deprecated. In order to read a value from conf/application.conf, you have to use DI instead.
Inject
play.api.Configuration
in your controller :class MyController @Inject() (val configuration: play.api.Configuration) extends Controller
Then, you can directly use
configuration
in your methods :You can also use
configuration
in your view Twirl template :Send the injected
configuration
as implicit to the givenindex.scala.html
Update for Play 2...
In Play Scala 2.3.x, to read a value from
conf/application.conf
, you can do the following:You can use following code sample to do so:
Also see http://groups.google.com/group/play-framework/browse_thread/thread/1412ca8fc3edd22f