grails-2.0

How to include jquery.js in Grails?

爱⌒轻易说出口 提交于 2019-12-03 01:28:42
I have a Grails 2.0.0 project that was created using grails create-app . In my HTML and GSP files, I'm trying to include jquery.js . I've tried all of the following without success: <script type="text/javascript" src="jquery/jquery-1.7.1.js"></script> <script type="text/javascript" src="jquery/jquery.js"></script> <g:javascript library="jquery"/> The first two <script> tags results in 404 Not Found (verified with Firebug). The <g:javascript> tag results in nothing being included (verified using view source). On my Grails application's home page, it indicates that jquery 1.7.1 is installed

Collect various data in a submit form with html table

泪湿孤枕 提交于 2019-12-02 22:02:16
问题 I have a jsp page with a table (paginated and with order columns), a search field and other filter based on check boxes. So that when I click on a button, it takes the pagination of the table, the order of the table, the value in the search field and eventually others parameters (check box) to perform the query. At the moment the table has a pagination and ordering columns using a tag library that fill the link with the necessary data to perform the query. So that when I click to page 2 as

how to use session in grails

拈花ヽ惹草 提交于 2019-12-02 21:06:15
I am new to grails. And I have to work with session. I have seen the session documentation. But no idea where to put the code in my controller. I have a page for student creation names createStudent. Now I want that this page only be access able when the user will be in session. Now how can I do it. Should I have to set the user in a variable at the time of login. Can anyone please help me on this ? def index() { def user = session["user"] if (user){ redirect(controller: 'admistratorAction', action: 'createUser') }else{ redirect(controller: 'login', action: 'index') } } You could use the

grails 2.0 - correct use of serverURL for production?

情到浓时终转凉″ 提交于 2019-12-02 20:33:25
Grails 2.0 changed with the way it uses grails.serverURL for development and test environments (as described in the manual ). However, I've had several problems with serverURL in regard to production deployment on Tomcat. There seem to be several options for serverURL (production mode): (Added) this setting is just "smoke and mirrors", because Tomcat and Jetty have methods to control how the URL is handled for the App, down to the "App" level. Use it to specify the server (as is pointed out as a "TODO" in Config.groovy) Don't use it as indicated here by one of the Grails contributors, i.e. "It

Collect various data in a submit form with html table

旧时模样 提交于 2019-12-02 12:23:32
I have a jsp page with a table (paginated and with order columns), a search field and other filter based on check boxes. So that when I click on a button, it takes the pagination of the table, the order of the table, the value in the search field and eventually others parameters (check box) to perform the query. At the moment the table has a pagination and ordering columns using a tag library that fill the link with the necessary data to perform the query. So that when I click to page 2 as example, it knows the order column. But if I have other fields and checkbox to include in the query how

Could not run Grails project GGTS

你。 提交于 2019-12-02 06:50:30
问题 I have a grails project that runs perfectly in the command line. When I try to run it in GGTS with grails run-app it runs the first time without any error. Then, I stopped the server and ran it again with grails run-app. Now the following errors occur. | Error 2013-04-29 15:32:14,965 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'annotationHandlerMapping': Invocation of init method failed; nested exception is java

Grails + GORM: What is the default equals() implementation in GORM?

和自甴很熟 提交于 2019-12-01 22:35:07
When I do domainObj1 == domainObj2 in Grails are the objects compared by ID? If not, how are they compared? Joshua Moore First, you need to understand that GORM/Grails doesn't do anything special when it comes to equals() . Unless you implement your own equals() on your domain class it will default to the Java/Groovy implementation. Which by default means the variables must point to the same instance. Now, what gets slightly confusing is Hibernate. Hibernate uses an identity map (the first-level cache); when you fetch the same domain instance from GORM, Hibernate will actually return the same

How can I render a GSP as a String?

亡梦爱人 提交于 2019-12-01 21:09:09
问题 For my email newsletter I need to render a GSP (the HTML for the newsletter) as a String , so I can pass it to my email method. I’ve found many solutions here on Stack Overflow, but I don't know which one would be the best to use with Grails 2.2 (the most recent version). So what’s your opinion? How would you render a GSP as a String without rendering it to the HTTP response? Thanks and best regards. Patrick 回答1: In Grails 2.x, you can inject a groovyPageRenderer into a service. This allows

How can I render a GSP as a String?

依然范特西╮ 提交于 2019-12-01 19:09:37
For my email newsletter I need to render a GSP (the HTML for the newsletter) as a String , so I can pass it to my email method. I’ve found many solutions here on Stack Overflow, but I don't know which one would be the best to use with Grails 2.2 (the most recent version). So what’s your opinion? How would you render a GSP as a String without rendering it to the HTTP response? Thanks and best regards. Patrick doelleri In Grails 2.x, you can inject a groovyPageRenderer into a service. This allows you to render any view or template you want via its render() method. For more information, check out

grails - simple App to test spring-security-core secure-channel on Heroku

独自空忆成欢 提交于 2019-12-01 09:01:13
问题 Because setting the ports in this question didn't solve the redirect loop problem, I created a bare-bones test app (grails 2.0, latest spring-security-core 1.2.7.1), so the redirect loop problem is easy to reproduce / hopefully solve: Here are the steps: 1- Created new app called test, and created a controller called simple (also in a test package), i.e.: package test class SimpleController { def index() { redirect action: 'start' } def start() { render "start - not secure" } def middle() {