Search Results

Search found 645 results on 26 pages for 'grails'.

Page 17/26 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Grails - How to format a value in a textfield into comma style such that it can be easily read?

    - by WaZ
    Hi there, I want to allow users enter numbers in textfield and once the textbox loses focus. The number is formatted with commas. e.g. User enters 100000 textfield looses focus value displayed: 100,000 How can I achieve this in Grails. I have looked at <g:formatNumber number="${myNumber}" format="\\$###,##0" /> But it doesnt solve my problem as the number is from a textfield. thanks Much appreciated.

    Read the article

  • Grails - Link checking as part of a continuous integration.

    - by Reverend Gonzo
    So, we have a grails app set up with a Hudson CI build process. We're running unit tests, integration tests, and about to set up Selenium for some functional tests as well. However, are there any good ways of fully testing a sites links to make sure nothing has broken in a release. I know there's link checkers in general, but I'd like to have it be a part of the build process, so a build outright fails if something isn't right.

    Read the article

  • Deploying multiple Grails instances with shared cache and sessions ?

    - by Kedare
    Hello, I am looking for a solution that allows me to deploy multiple load balanced Grails instances that have shared cache (EhCache Server ?) and sessions, is this possible ? I can't find any documentation on this (connecting to a common EhCache server or using Distributed EhCache, and sharing sessions (using EhCache too ?))... I'm looking for something that will work like multiple Rails instances with a common memcached and sessions/caches stored in the memcached... Can you help me ? Thank you !

    Read the article

  • Grails: How can I search through children in a hasMany relationship?

    - by intargc
    If I have a Client domain class, and that Client hasMany Courses. How do I find the course I'm looking for? For instance: class Client { String name static hasMany = [courses:Course] } class Course { String name static belongsTo = [client:Client] } def client = Client.get(1) I want to "find" or "search" within that courses relationship. Maybe something like: client.courses.find(name:'Whatever') Is there any way to do this with Grails?

    Read the article

  • Does grails support logging from the src/java classes?

    - by rainyday
    I have a grails app (v 1.1.2) the logging is working fine from the groovy classes, but I can't get it to work from within a java source... I have a class in package com.mforms.devices., it imports apache log4j, defines the logger as follows private final org.apache.log4j.Logger loggy = Logger.getLogger(this.getClass()); then refer to it later by doing loggy.error("...") my Config.groovy has the following log4j = { error 'com.mforms' root { error 'stdout', 'file' additivity = true } } What am I doing wrong?!?!

    Read the article

  • Translate Basic Config.groovy log4j DSL to external log4j.properties

    - by Stephen Swensen
    The following is a basic log4j configuration inside Config.groovy using the log4j DSL with Grails 1.2, it works as expected (log all errors to the given file): log4j = { appenders { file name:'file', file:"c:/error.log" } error 'grails.app' root { error 'file' } } How would one translate this into a properties style log4j configuration file? The following does not work: log4j.rootLogger=ERROR, FA log4j.appender.FA=org.apache.log4j.FileAppender log4j.appender.FA.File=C:/error.log log4j.logger.grails.app=ERROR, FA I suspect it has something to do with the translation of error 'grails.app' but I really don't know. If it makes any difference, the properties file is configured externally: grails.config.locations = ["file:${basedir}/extconf/log4j.properties"] All I really want is an external log4j properties file which logs all application exceptions to a file.

    Read the article

  • Ruby on Rails vs Grails vs. Spring ROO vs. Spring App

    - by lizdev
    Hi, I'm planning on writing a simple web application that will be used by lots of users (as complicated as a simple bookmarking app) and I'm trying to decide which framework/language to use. I'm very experienced with Spring/Hibernate and Java in general but new to both Grails and RoR (and Spring ROO). The only reason I'm considering RoR is because Java hosting is MUCH more expensive than RoR hosting (which is supported by almost any hosting vendor for 5$ per month). Assuming the price wasn't an issue, which one of the frameworks/languages mentioned above would you recommend for a Java developer (who knows how to configure Spring/Hibernate etc.)? I'm afraid that by using RoR I won't be able to easily support many users who are using the website at the same time. thanks

    Read the article

  • How to set up an insert to a grails created file with next sequence number?

    - by Jack BeNimble
    I'm using a JMS queue to read from and insert data into a postgres table created by grails. The problem is obtaining the next sequence value. I thought I had found the solution with the following statement (by putting "DEFAULT" where the ID should go), but it's no longer working. I must have changed something, because I needed to recreate the table. What's the best way to get around this problem? ps = c.prepareStatement("INSERT INTO xml_test (id, version, xml_text) VALUES (DEFAULT, 0, ?)"); UPDATE: In response to the suggested solution, I did the following: Added this to the the domain: class XmlTest { String xmlText static constraints = { id generator:'sequence', params:[name:'xmltest_sequence'] } } And changed the insert statement to the following: ps = c.prepareStatement("INSERT INTO xml_test (id, version, xml_text) VALUES (nextval('xmltest_sequence'), 0, ?)"); However, when I run the statement, I get the following error: [java] 1 org.postgresql.util.PSQLException: ERROR: relation "xmltest_sequence" does not exist Any thoughts?

    Read the article

  • grails gsp test evaluates to false, but block is still rendered. Why?

    - by ?????
    I'm baffled with Grails test operator. This expression: <g:if test="${!(preferences.displayOption.equals('ANA') || preferences.displayOption.equals('FLOP'))} "> ${!(preferences.displayOption.equals('ANA') || preferences.displayOption.equals('FLOP'))} </g:if> prints false How can that be? I'm printing the exact same condition I'm testing for! even though I'm certain the test condition evaluates to 'false' because it prints false in the very next line, the statements inside the g:if are being rendered. Anu ideas as to what's going on.

    Read the article

  • How to upload a directory via Grails or Java ?

    - by fabien-barbier
    What is the best way to upload a directory in grails ? I try this code : def upload = { if(request.method == 'POST') { Iterator itr = request.getFileNames(); while(itr.hasNext()) { MultipartFile file = request.getFile(itr.next()); File destination = new File(file.getOriginalFilename()) if (!file.isEmpty()) { file.transferTo(destination) // success } else { // failure } } response.sendError(200,'Done'); } } Unfortunately, I can only upload file by file. I would like to define my directory, and upload all files directly. Any ideas ?

    Read the article

  • Why don't Domain class static methods work from inside a grails "service"?

    - by ?????
    I want a grails service to be able to access Domain static methods, for queries, etc. For example, in a controller, I can call IncomingCall.count() to get the number of records in table "IncomingCall" but if I try to do this from inside a service, I get the error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'incomingStatusService': Invocation of init method failed; nested exception is groovy.lang.MissingMethodException: No signature of method: static ms.wdw.tropocontrol.IncomingCall.count() is applicable for argument types: () values: [] How do these methods get injected? There's no magic def statement in a controller that appears to do this. Or is the problem that Hibernate isn't available from my Service class?

    Read the article

  • mocking command object in grails controller results in hasErrors() return false no matter what! Plea

    - by egervari
    I have a controller that uses a command object in a controller action. When mocking this command object in a grails' controller unit test, the hasErrors() method always returns false, even when I am purposefully violating its constraints. def save = { RegistrationForm form -> if(form.hasErrors()) { // code block never gets executed } else { // code block always gets executed } } In the test itself, I do this: mockCommandObject(RegistrationForm) def form = new RegistrationForm(emailAddress: "ken.bad@gmail", password: "secret", confirmPassword: "wrong") controller.save(form) I am purposefully giving it a bad email address, and I am making sure the password and the confirmPassword properties are different. In this case, hasErrors() should return true... but it doesn't. I don't know how my testing can be any where reliable if such a basic thing does not work :/ Here is the RegistrationForm class, so you can see the constraints I am using: class RegistrationForm { def springSecurityService String emailAddress String password String confirmPassword String getEncryptedPassword() { springSecurityService.encodePassword(password) } static constraints = { emailAddress(blank: false, email: true) password(blank: false, minSize:4, maxSize: 10) confirmPassword(blank: false, validator: { confirmPassword, form -> confirmPassword == form.password }) } }

    Read the article

  • Is it possible to map a root domain URL to a Grails' controller?

    - by firnnauriel
    Let's have an example: A grails project, myproj, is deployed in Tomcat 6. It can be accessed anywhere thru this link: http://www.mycompany.com/myproj. Let's say we purchase another domain, http://newcompany.com, and we would like to point it to http://www.mycompany.com/myproj/url. If I go to http://newcompany.com/12345, it should be the same as doing http://www.mycompany.com/myproj/url/12345. Can anyone tell me if this is possible? How to implement it (change Tomcat 6 config, add code in UrlMappings.groovy)? Thanks in advance.

    Read the article

  • How to handle Many-To-Many In Grails without belongsTo?

    - by nute
    I need to create a many-to-many relationship in Grails. I have a "Question" domain and a "Tag" domain. A Question can have 0 or more tags. A Tag can have 0 or more Questions. If I put a "hasMany" on each sides, it gives me an error saying I need a "belongTo" somewhere. However, adding a belongsTo means that the owner must exist... Like I said, a Tag could have 0 questions, and a Question could have 0 tags. There is no concept of an owner, it's a many-to-many! What am I supposed to do?

    Read the article

  • How to test flash.message in a Grails webflow?

    - by callie16
    I'm using webflows in Grails and I'm currently writing tests for it. Now, inside I've got something that throws an error so I set a message to the flash scope before redirecting: ... if (some_condition) { flash.message = "my error message" return error() } ... Now, I know that when I'm going to display this in the GSP page, I access the flash message as <g:if test="${message}">... instead of the usual <g:if test="${flash.message}">... So anyway, I'm writing my test and I'm wondering how to test the content of the message? Usually, in normal actions in the controllers, I follow what's written in here . However, since this is a webflow, I can't seem to find the message even if I check controller.flash.message / controller.params.message / controller.message . I've also tried looking at the flow scope... Any ideas on how to see the message then? Thanks a bunch!

    Read the article

  • how to made one-to-one bidirectional relationships in grails?

    - by user369759
    I have two domain classes and want to have one-to-one BIDIRECTIONAL relation between them. I write: class Person { Book book; String name Integer age Date lastVisit static constraints = { book unique: true // "one-to-one". Without that = "Many-to-one". } } class Book { String title Date releaseDate String ISBN static belongsTo = [person:Person] // it makes relationship bi-directional regarding the grails-docs } So, i want to have bi-directional, i could NOT find link from Book to Person in generated SQL: CREATE TABLE `book` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `version` bigint(20) NOT NULL, `isbn` varchar(255) NOT NULL, `release_date` datetime NOT NULL, `title` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 So then it means it is not bidirectional then? How to make bidirectional?

    Read the article

  • No difference between nullable:true and nullable:false in Grails 1.3.6?

    - by knorv
    The following domain model definition .. class Test { String a String b static mapping = { version(false) table("test_table") a(nullable: false) b(nullable: true) } } .. yields the following MySQL schema .. CREATE TABLE test_table ( id bigint(20) NOT NULL AUTO_INCREMENT, a varchar(255) NOT NULL, b varchar(255) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Please note that a and b get identical MySQL column definitions despite the fact a is defined as non-nullable and b is nullable in the GORM mappings. What am I doing wrong? I'm running Grails 1.3.6.

    Read the article

  • image/jpeg returned by groovy/grails is OK on development system, but corrupt on prod system. What c

    - by ?????
    I have a groovy/grails application that needs to serve images It works fine on my dev box, the image is returned properly. Here's the start of the returned JPEG, as seen by od -cx 0000000 377 330 377 340 \0 020 J F I F \0 001 001 001 001 , d8ff e0ff 1000 464a 4649 0100 0101 2c01 but on the production box, there's some garbage in front, and the d8ff e0ff before the 1000 is missing 0000000 ? ** ** ? ** ** ? ** ** ? ** ** \0 020 J F bfef efbd bdbf bfef efbd bdbf 1000 464a 0000020 I F \0 001 001 001 \0 H \0 H \0 \0 ? ** ** ? 4649 0100 0101 4800 4800 0000 bfef efbd It's the exact same code. I just moved the .war over and run it on a different machine. (Isn't Java supposed to be write once, run everywhere?) Any ideas? An "encoding" problem? The code is sent to the response like this: response.contentType = "image/jpeg"; response.outputStream << out;

    Read the article

  • grailsui plugin for accordion not working

    - by inquirer
    Hi! I have been trying to figure out what's wrong with grailsui accordion. I have checked out the sample source files (http://guidemo.googlecode.com/svn/trunk/) from different ui tags, like menu, datatable and etc. they are working fine but the accordion is not working properly. All i can see is all of the divs shown. the panels are not moving since they are already shown. I've also followed the screencast for it. I've used the yui-skin-sam class name and I've downloaded the grails plugins.grails-ui=1.2-SNAPSHOT. I am not sure what's wrong.I used the rich-ui plugin and it is working great. But there are still features that are not in rich-ui compared to the possible configurations for the grails-ui tags. Anyway. if you have any suggestions to what js library I may use for a grails application or if you have a working grails-ui accordion sample, I would really appreciate it. Thanks in advance. Hope you can help me since I am still new to Grails.

    Read the article

  • How to test a Grails Service that utilizes a criteria query (with spock)?

    - by user569825
    I am trying to test a simple service method. That method mainly just returns the results of a criteria query for which I want to test if it returns the one result or not (depending on what is queried for). The problem is, that I am unaware of how to right the corresponding test correctly. I am trying to accomplish it via spock, but doing the same with any other way of testing also fails. Can one tell me how to amend the test in order to make it work for the task at hand? (BTW I'd like to keep it a unit test, if possible.) The EventService Method public HashSet<Event> listEventsForDate(Date date, int offset, int max) { date.clearTime() def c = Event.createCriteria() def results = c { and { le("startDate", date+1) // starts tonight at midnight or prior? ge("endDate", date) // ends today or later? } maxResults(max) order("startDate", "desc") } return results } The Spock Specification package myapp import grails.plugin.spock.* import spock.lang.* class EventServiceSpec extends Specification { def event def eventService = new EventService() def setup() { event = new Event() event.publisher = Mock(User) event.title = 'et' event.urlTitle = 'ut' event.details = 'details' event.location = 'location' event.startDate = new Date(2010,11,20, 9, 0) event.endDate = new Date(2011, 3, 7,18, 0) } def "list the Events of a specific date"() { given: "An event ranging over multiple days" when: "I look up a date for its respective events" def results = eventService.listEventsForDate(searchDate, 0, 100) then: "The event is found or not - depending on the requested date" numberOfResults == results.size() where: searchDate | numberOfResults new Date(2010,10,19) | 0 // one day before startDate new Date(2010,10,20) | 1 // at startDate new Date(2010,10,21) | 1 // one day after startDate new Date(2011, 1, 1) | 1 // someday during the event range new Date(2011, 3, 6) | 1 // one day before endDate new Date(2011, 3, 7) | 1 // at endDate new Date(2011, 3, 8) | 0 // one day after endDate } } The Error groovy.lang.MissingMethodException: No signature of method: static myapp.Event.createCriteria() is applicable for argument types: () values: [] at myapp.EventService.listEventsForDate(EventService.groovy:47) at myapp.EventServiceSpec.list the Events of a specific date(EventServiceSpec.groovy:29)

    Read the article

  • Grails project structure

    - by Martin Janicek
    Good news everyone! I've changed the structure of the Grails project as requested in the issue 160028 and it should be much more user friendly than before. There are actually two things I've fixed/implemented. First of all the source folders are finally represented in the same way as for the Java projects (which means instead of the folder based structure it uses package based structure). The difference can be seen on pictures bellow:    Folder based structure:                                                 Package based structure: Second, minor and quite related change could be seen on those pictures too. There are different icons for different structures. For example Views and Layouts items are folder based, Domain Classes are package based and so on.

    Read the article

  • How can I tell groovy/grails not to try to "re-encode" binary data? (Revised title)

    - by ?????
    I have a groovy/grails application that needs to serve images It works fine on my dev box, the image is returned properly. Here's the start of the returned JPEG, as seen by od -cx 0000000 377 330 377 340 \0 020 J F I F \0 001 001 001 001 , d8ff e0ff 1000 464a 4649 0100 0101 2c01 but on the production box, there's some garbage in front, and the d8ff e0ff before the 1000 is missing 0000000 ? ** ** ? ** ** ? ** ** ? ** ** \0 020 J F bfef efbd bdbf bfef efbd bdbf 1000 464a 0000020 I F \0 001 001 001 \0 H \0 H \0 \0 ? ** ** ? 4649 0100 0101 4800 4800 0000 bfef efbd It's the exact same code. I just moved the .war over and run it on a different machine. (Isn't Java supposed to be write once, run everywhere?) Any ideas? An "encoding" problem? The code is sent to the response like this: response.contentType = "image/jpeg"; response.outputStream << out; Here's the code that locates the image on an internal application server and re-serves the image. I've pared down the code a bit to remove the error handling, etc, to make it easier to read. def show = { def address = "http://internal.application.server:9899/img?photoid=${params.id}" def out = new ByteArrayOutputStream() out << new URL(address).openStream() response.contentLength = out.size(); // XXX If you don't do this hack, "head" requests won't work! if (request.method == 'HEAD') { render( text : "", contentType : "image/jpeg" ); } else { response.contentType = "image/jpeg"; response.outputStream << out; } } Update: I tried setting the CharacterEncoding response.setCharacterEncoding("ISO-8859-1"); if (request.method == 'HEAD') { render( text : "", contentType : "image/jpeg" ); } else { response.contentType = "image/jpeg;charset=ISO-8859-1"; response.outputStream << out; } but it made no difference in the output. On my production machine, the binary bytes in the image are re-encoded/escaped as if they were UTF-8 (see Michael's explanation below). It works fine on my development machine.

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >