Groovy grails SCI Share First tutorial 1, download tool:
Http://www.springsource.org/downloads/sts-ggts
Direct address: Spring-tool-suite-3.0.0.release-e4.2-win32-installer.exe
2. Install and Open
3. Install Groovy and Grails plugins
4. Create a Grails project
5. Add the required files
6. Add Project to Server
7. Running the server
Http:
The ORM-style domain will eventually be reflected in the database table, and the subordination of the domain class will be reflected by the database Association ing.
One-to-many/multiple-to-one
---
_ Example __:
Class country:[PK] + id+ Name
Class province:[PK] + id+ Name[FK]-> + country
The 'country' country can have multiple provinces. In terms of countries and provinces, it is a _ one-to-many _ relationship.The 'province 'province can belong to only one country, and the 'country' indicates t
Grails has a good integration of Ajax, which describes the use of jquery's Getjson method for asynchronous Ajax transmission.Steps to use:
Introduction of jquery (. GSP page introduced Jquery.js)
Add Ajax calling methods in Javascript scripts
function Isproductionnameexist (o) { var productName = "Test"; var mode = "Test"; $.getjson ("Isproductionnameexist", //action in controller
grails:2.4.xIde:intellij Idea 13.xIf there is a ring reference between Grails domain objects, using the as JSON directly will only output the ID of the associated object, and if you use deep it will also be an error and deep does not support hierarchical output settings. Not up to some application requirements.So I turned over the internet a lot of information, and finally tested a relatively simple and rel
Oracle announces that it will participate in the Grails Open source program, helping to improve the productivity of Java program developers by closely matching the groovy instruction language.Grails builds on open source technologies such as spring, Hibernate, and Sitemesh, providing a rails-like platform for seamless integration with the Java platform. Groovy is a "dynamic" or instruction language. Dynamic languages are generally used to speed up and
The grails I used was 2.4.4.The version downstream of a label g:paginateThe following parameters are available under this tab: Total (items that must be filled in), Controller, action, prev, Max, offset, and so on, which I use to refer to the API documentation for detailed parameters.Normal paging: (Tsystemparam is a domain class of my Code)Background code: Write the method that needs to be executed under the controllerparams.max=5//the params paramet
Grails domain class verification (constraint attribute), that is, the 'straints' closure of the domain class, is used for validation of each field. grails provides a total of 16 Input Validation and a custom validation.
'Straints'
[Blank] (# gblank) ...... null
[Creditcard] (# creditcard) ...... credit card format
[Email] (# email) ...... email format
[Inlist] (# inlist) ...... specifies the range
[Matches
> To export PDF in Java Web/grails, the best solution on the Internet is to use the [flyingsaucer] (https://github.com/flyingsaucerproject/flyingsaucer "flying saucer") Library.
> There are always various problems that can be found on the Internet with the ready-made V8 jar packages, such as bugs in CSS that 'word-wrapp' does not work,
> We need to download all the source code from the GIT homepage of the project and compile it with ** Maven.
Comp
Grails services use Boolean transactional = true to add transactions for each method in the service. The default propagation mode of transactions is propagation. required, readonly = false, cannot be modified. If some methods in the service need read-only transactions, this method cannot meet the requirements. Because the grails service is a bean, you can use spring's Annotation transaction @ transactional
I once had doubts about projects such as xruby jruby. Why does it take time to associate JVM with Ruby? The answer is fast and reusable.
I am more interested in the scripting language. Ruby is my favorite scripting language, followed by JavaScript. I have heard of the groovy scripting language a long time ago, but I have never touched on it. This may be related to my C and C ++ origins. Sometimes, I reject Java and do not care much about Java. (Of course, you still need to learn and use it for
The Grails framework, used by CKEditor to get the rich text of user edits, needs to be presented, with the following issues:1. Malicious code hazard:When rendering an HTML file or XHTML file, you must call Encodeashtml () on each object.2, how to render as HTML, rather than source code.such as a text , want to appear as Baidu Method 1, the direct use of ${content in the GSP will render the source code, should use ${raw (content)}, or Add the following
Ajax is a great technology, and grails requires a combination of both the GSP and the controller:First, set up an area in the GSP for display-the key is the set ID. Like what:Then, in the GSP, you set theUpdate= "[Success: ' Systemmenueditdiv ', failure: ' Error ']"on404= "alert (' not found ')"class= "Create" > New root node The method in the controller is called through RemoteLink.The key to the function in the controller is the return control.if (R
I. Referencing the Shiro plugin// Add compile ": shiro:1.2.1" under Buildconfig's pluginsTwo. To compile after referencing the new plugin// grails Command compileThree. Creating Scaffolding files// grials Command, pay attention to the latter point, otherwise the generated good file will be confused Shiro-quick-start--prefix=com.security.Four. Configure Bootstrap.groovyclassBootStrap {def shirosecurityservice def init= {ServletContext//Create the Admin
Preface:
The language is refined and self-generated. Well, let's talk less. Here, I am going to start learning grails from the very beginning. With the deep learning, I will continue to improve this article.Article.
I don't want to write profound technologies, nor attract the attention of many netizens. I want to leave some memories for myself and share some feelings with friends. The show starts...
The first article to be read is here. Haha, som
Domain stores the Emoji property type setting bit byte[]
Class Usertest { byte[] namebytes//Store emoji emoticon field date dateCreated //grails time Magic field insert automatically gets current system time date lastupdated //grails time Magic field update automatically gets current system modification time static constraints = { } // Custom get, Set method conversion byte[] a
Working with Groovy while learning grails is unavoidable, though not too deep, but it's also helpful to know a few features.
1. Get integers after dividingUse the intdiv () method to get an integer, note that this method only applies to dividing two integers , floating-point numbers do notIf,while acceptable type of 2.Groovy
Boolean
Number 0 is false, others are true
String null character "" is false, others are true
The obj
G5. User.listorderbydepartment () *.department.unique ()
What this statement can do. G5 is the program name, user is the domain name is the database name, department is the field name, this statement means to remove all data from the user database and Sort by department field, Separate the Department this field (no data from other fields) and eliminate duplicate items.
As I understand it, grails either using list or FindAll data is an array list (Ar
There are multiple ways to implement cascading update. Now we only introduce how to implement it using the Ajax technology of the jquery framework. I personally think that jquery is better and more flexible, because it is only responsible for transmitting data, asynchronous updates provided by grails are simple and complicated.
The following code does not need to consider the business Significance
Ajax Implementation of jquery:
1. Simple code of _ for
Because the controller's name is generally capitalized, such as login at this timeClass Logincontroller {def index = {Redirect (action:Login, Params:params)}def login={}Then there will be an error that cannot be found on the login controller.Note that at this point login should be changed to lowercase beginning as followsClass Logincontroller {def index = {Redirect (action:login, Params:params)}def login={}One possible reason for grails redirect not t
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.