[play framework] Seperate the admin, and build it as a module in play framework
2010-09-28 17:56
477 查看
I am a fresh man of java and play framework, maybe there is everyone know how to seperate the admin to a module, so please forgive me and help to build play framework better. :)
Let use yabe for example.
代码
In yabe, we can know that, the function of admin is developed in the root controllers, that is to say, CRUD is under the controllers, do you think that is not so convenience to manage the project?
But thanks to play-framework, we can build a admin module in it.
Here is the structure.
1. Create the module.
Create a folder "admin" under the root, then you can just copy the folders (app, conf, public) to the admin
2. Add a file "Admin.java", locate at /admin/app/controllers, we will use it as the default entry of the module.
2. Add the code to the /conf/routes file
3. Modify the file /admin/conf/routs, remove all the code, and add the code as :
Then start the project, and visit 127.0.0.1:9000/admin. Cool! The path of website is running well!
Have fun with play-framework!
Let use yabe for example.
代码
| |~yabe/ | | |~app/ | | | |~controllers/ | | | | |-Admin.java* | | | | |-Application.java* | | | | |-Comments.java* | | | | |-Posts.java* | | | | |-Security.java* | | | | |-Tags.java* | | | | `-Users.java* | | | |+models/ | | | |+views/ | | | `-Bootstrap.java*
In yabe, we can know that, the function of admin is developed in the root controllers, that is to say, CRUD is under the controllers, do you think that is not so convenience to manage the project?
But thanks to play-framework, we can build a admin module in it.
Here is the structure.
| |~yabe/ | | |~admin/ | | | |+app/ | | | |+conf/ | | | `+public/ | | |+app/ | | |+conf/ | | |+lib/ | | |+logs/ | | |+public/ | | |+test/ | | `+tmp/
1. Create the module.
Create a folder "admin" under the root, then you can just copy the folders (app, conf, public) to the admin
2. Add a file "Admin.java", locate at /admin/app/controllers, we will use it as the default entry of the module.
2. Add the code to the /conf/routes file
GET /admin module:admin
3. Modify the file /admin/conf/routs, remove all the code, and add the code as :
GET / Admin.index
Then start the project, and visit 127.0.0.1:9000/admin. Cool! The path of website is running well!
Have fun with play-framework!
相关文章推荐
- Matrix and linear algebra in F#, Part IV: profile your program, find the bottleneck and speed it up: using matrix multiplication as an example[z]
- Android: How to download the latest zip Android Source Code easily and using it in Intellij
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- 设计: ListView 接口,and the missing read-only interfaces in java collection framework
- Atlas Control Toolkit and Source Code for the Build-in Asp.Net 2.0 Providers
- Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to
- Android Build with Gradle and ProGuard : “The output jar must be specified after an input jar, or it
- [原]openstack-kilo--issue(十九) ImportError: Could not import settings 'openstack_dashboard.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named main
- Developers’ Must-have: the new Microsoft All-In-One Code Framework Sample Browser and 3500+ samples
- Create an Entity Framework Model and Use it in Multiple Projects
- Unable to add module to the current project as it is not of packaging type 'pom'
- Paper Notes: On Community Detection in Real-world Networks and the Importance of Degree Assortativit
- it has a DefiningQuery and no InsertFunction element exists in the ModificationFunctionMapping element to support the current op
- CRS-2800: Cannot start resource 'ora.DATADG.dg' as it is already in the INTERMEDIATE state on se
- Use the unsinged type as operands of shift operator in C language
- sql server 小技巧(6) Cannot resolve the collation conflict between "Latin1_General_CI_AI" and "Chinese_PRC_CI_AS" in the equal to operation
- A heat-filled weekend NBA Feet in the form of air jordan shoes, Foamposites, LeBron and others, so lets right it! Rajon Rondo broke necks with Foampos
- The `android.dexOptions.incremental` property is deprecated and it has no effect on the build proces
- How to install Android SDK and play with Android 2.0 in the emulator
- 从2009年至2014年脸书(Facebook)的用户行为及其发展 The User Behavior in Facebook and its Development from 2009 until