Search Results

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

Page 12/26 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Map problem when passing it as model to view in grails

    - by xain
    Hi, In a controller, I have populated a map that has a string as key and a list as value; in the gsp, I try to show them like this: <g:each in="${sector}" var="entry" > <br/>${entry.key}<br/> <g:each in="${entry.value}" var="item" > ${item.name}<br/> </g:each> </g:each> The problem is that item is considered as string, so I get the exception Error 500: Error evaluating expression [item.name] on line [11]: groovy.lang.MissingPropertyException: No such property: nombre for class: java.lang.String Any hints on how to fix it other than doing the find for the item explicitly in the gsp ?

    Read the article

  • Grails Shiro plugin : confirming my understanding

    - by bsreekanth
    I'm bit vague about how to start using the shiro plugin, after reading few documents. I decided against Nimble, as it comes with few tables and UI plugins. I setup shiro plugin with wildcard realm, with my own tables. I may use permission based (rather tan role based) access control as it scales well. Now, the steps for it. assign the permission string to the subject, and save it in the db check the permission through isPermitted, hasPermission (or relevant tags in GSP). Now, 1. when to use the accesscontrol through filter? 2. is there a closure injected into the controller where I can define the permission for the actions in it? 3. How do I create a typical access control scenario like only the creator of (something, a post etc) can delete it? thanks a lot.. Babu.

    Read the article

  • rendering JSON in GRAILS with part of the attributes of an object

    - by bsreekanth
    Hello, I am trying to build JSON from two fields. Say, I have a list of object(party), and I only need to pass 2 items as JSON pair. def list = getMyList() //it contains 2 party objects partyTo = array { for (i in list) { x partyId: i.id y partyName: i.toString() } } The JSON string is {"partyTo":[ {"partyId":12}, {"partyName":"Ar"}, {"partyId":9}, {"partyName":"Sr"} ] } when I extract it at the client, it is treated as 4 objects. I wanted as 2 objects, with the below format. {"partyTo":[ {"partyId":12 , "partyName":"Ar"}, {"partyId":9 , "partyName":"Sr"} ] } I'm getting 4 objects, probably because I use an array to build JSON. I'm new to groovy and JSON, so not sure about the right syntax combinations. Any help highly appreciated. thanks.

    Read the article

  • Grails 1.2.1 Tomcat SSI configuration

    - by Visionary Software Solutions
    Neither a Tomcat nor SSI pro, I'm trying to use a provided template that relies on them heavily for look and feel. The Tomcat page says that SSI is disabled by default. It's installation instructions talk about renaming a Catalina.jar file, which I cannot find in $GRAILS_HOME. How can I configure the bundled Tomcat instance for SSI?

    Read the article

  • Grails checkbox

    - by Tomáš
    Hi gurus I have trouble with binding Boolean property in association classes. Property is set to true if I check checkbox (good), but is null if checbox is not checked. I know the problem with HTML checkbox. I know why is send "_fieldName" in params, but this "_fieldName" dont set my boolean property to false. class Person{ String title List<Group> groups = new ArrayList() static hasMany = [groups: Groups] } class Group{ String title Boolean isHidden static belongTo = Person } class PersonController{ def form = { def person = new Person() person.groups.add( new Group() ) return ["person": person] } def handleForm = { def person = new Person( params ) println person.groups[0] } } If I check checkbox: [isHidden:on, title:a, _isHidden:] println person.groups[0] //true If I don check checkbox: [title:a, _isHidden:] println person.groups[0] //null Thank a lot for help Tom I am sorry, I searched this web, but did not get actual info for my trouble.

    Read the article

  • Grails / GORM, read-only cache and transient fields

    - by Stephen Swensen
    Suppose I have the following Domain object mapping to a legacy table, utilizing read-only second-level cache, and having a transient field: class DomainObject { static def transients = ['userId'] Long id Long userId static mapping = { cache usage: 'read-only' table 'SOME_TABLE' } } I have a problem, references to DomainObject instances seem to be shared due to the caching, and thus transient fields are writing over each other. For example, def r1 = DomainObject.get(1) r1.userId = 22 def r2 = DomainObject.get(1) r2.userId = 34 assert r1.userId == 34 That is, r1 and r2 are references to the same instance. This is undesirable, I would like to cache the table data without sharing references. Any ideas?

    Read the article

  • Grails multiple databases

    - by srinath
    Hi, how can we write queries on 2 databases . I installed datasources plugin and domain classes are : class Organization { long id long company_id String name static mapping = { version false table 'organization_' id column : 'organizationId' company_id column : 'companyId' name column : 'name' } } class Assoc { Integer id Integer association_id Integer organization_id static mapping = { version false table 'assoc' id column : 'ASSOC_ID' association_id column : 'ASSOCIATION_ID' organization_id column : 'ORGANIZATION_ID' } } this is working : def org = Organization.list() def assoc = Assoc.list() and this is not working : def query = Organization.executeQuery("SELECT o.name as name, o.id FROM Organization o WHERE o.id IN (SELECT a.organization_id FROM Assoc a )") error : org.hibernate.hql.ast.QuerySyntaxException: Assoc is not mapped [SELECT o.name as name, o.id FROM org.com.domain.Organization o WHERE o.id IN (SELECT a.organization_id FROM AssocOrg a )] How can we connect with 2 databases using single query ? thanks in advance .

    Read the article

  • Grails- Unique constraint

    - by WaZ
    How can I basically carry out a unique constraint on a string data-type field. class User{ String username String Email static hasMany = [roles:Roles] static constraints = { Email(email:true) username(unique:true) } Is there any simple way to implement username(unique:true) or I will have to manually check the database by the in-built methods like .findByNameLike. My need is that username should be unique and should be case insensitive

    Read the article

  • Grails Date Property Editor

    - by Jan
    Hey folks, i'm using the jQuery UI datepicker instead of the <g:datePicker>, which is changing the selected date in a textbox. Now I want to save this neatly back into my database, and came across custom property editors. click me hard to see the topic on StackOverflow However, adding this custom PropertyEditor didn't change anything, dates are still displayed like '2010-01-01 00:00:00.0' and if I try to save a date it crashes with Cannot cast object '05.05.2010' with class 'java.lang.String' to class 'java.util.Date'. Is there any additional magic needed, like a special naming of the textbox or something like that? Thanks for your help, Jan

    Read the article

  • Grails/Groovy taglib handling parsing dynamically inserted tags.

    - by Dan Guy
    Is there a way to have a custom taglib operate on data loaded in a .gsp file such that it picks up any tags embedded in the data stored in the database. For instance, let's say I'm doing: <g:each in="${activities}"> <li>${it.payload}</li> </g:each> And inside the payload, which is coming from the database, is text like "Person a did event <company:event id="15124124">Event Description</company:event>" Can you have a taglib that handles company:event tags on the fly?

    Read the article

  • Grails efficient hasMany-Relationship in View

    - by Jan
    Hi folks, I'm saving contacts (email, mobile phone, ICQ, AIM etc.) for people like this: class Person { static hasMany = { contacts: Contact } } class Contact { String code ContactType type } class ContactType { String name } In my view, I've written some Templates for displaying each contact with a select-box for the contact-type and a textfield for the code, spiced up with some JavaScript for adding and deleting. My question is: Is there an easy and elegant way to update the data similar to personInstance.properties = params or do I have to read out all the fields, deleting removed, updating changed and adding new ones?

    Read the article

  • Grails - Self Join

    - by WaZ
    Hi, When I write the following class, I get the following compilation error: could not resolve property How can I achive the following: class Employee{ String Name String Email Employee Manager static hasMany = [desginations:Designation] static constraints = { Name(unique:true) Email(unique:true) } Thanks, Much appreciated.

    Read the article

  • How to use Enum in grails (not in domain class)

    - by bsreekanth
    Hello, i want to use Enum to represent some selection values. In /src/groovy folder, under the package com.test, I created the Enum. package com.test public enum TabSelectorEnum { A(1), B(2) private final int value public int value() {return value} } Now, I am trying to access it from controller like TabSelectorEnum.B.value() It throws an exception Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoClassDefFoundError: Could not initialize class com.test.TabSelectorEnum thanks in advance.

    Read the article

  • Grails withCriteria testing

    - by Steve Wall
    Hello, I'd like to test a "withCriteria" closure and am not sure how to go about it. I see how to mock out the withCriteria call, but not test the code within the closure. When running the test that executes the "withCriteria", I keep getting a MissingMethodException, even though the code runs fine under the normal flow of execution. Any ideas? Thanks! Steve

    Read the article

  • Using Google and Yahoo OpenID service in Grails ACEGI

    - by firnnauriel
    I am using acegi-0.5.2 and was able to make myOpenID account work (had to add http://.myopenid.com/ in the database). Now, I'm wondering how to make the Google and Yahoo openid URL work. I'm using these URLs: https://www.google.com/accounts/o8/id http://yahoo.com/ Any help on how to make them work? Do i need to install this plugin? Thanks in advance.

    Read the article

  • Groovy on Grails: GORM and BitSets?

    - by Visionary Software Solutions
    I don't see anything in the official documentation about unsupported persistence data types, so I'm working under the assumption that types available in the Groovy language should be handled. However, for the following domain class: class DocGroupPermissions { Workgroup workgroup; Document document; BitSet permissions = new BitSet(2) public DocGroupPermissions() {} void setPermissions(boolean canRead, boolean canWrite){ setReadPermissions(canRead) setWritePermissions(canWrite) } BitSet getPermissions() { return permissions } void setReadPermissions(boolean canRead) { permissions.set(0,canRead) } void setWritePermissions(boolean canWrite) { permissions.set(1,canWrite) } boolean getReadPermissions() { return permissions.get(0) } boolean getWritePermissions() { return permissions.get(1) } static belongsTo = [workgroup:Workgroup, document:Document] static constraints = { workgroup(nullable:false, blank:false) document(nullable:false, blank:false) } } I'm getting: 2009-11-15 16:46:12,298 [main] ERROR context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table doc_group_permissions refers to an unmapped class: java.util.BitSet Has anyone run into this before?

    Read the article

  • Getting the OpenID URL from a Grails Controller/Service

    - by firnnauriel
    I'm using acegi 0.5.2 and enabled OpenID support. I would like to know how to accesss the URL (or username) returned by a provider (i.e. Google, Yahoo!). I can't find any docs about that so I traced the code of acegi and found this in GrailsOpenIdAuthenticationProvider: OpenIDAuthenticationToken response = (OpenIDAuthenticationToken) authentication OpenIDAuthenticationStatus status = response.status // handle the various possibilites if (status == OpenIDAuthenticationStatus.SUCCESS) { // Lookup user details UserDetails userDetails = _userDetailsService.loadUserByUsername(response.identityUrl) return new GrailsOpenIdAuthenticationToken(userDetails, response.status, response.identityUrl) } it seems that the response.identityUrl contains what i need. How can get it from a controller's (or service's) space? Thanks.

    Read the article

  • Find Object in Many-to-Many Szanario - Grails

    - by Oliver
    Hello, i got this situation: - class user with hasMany Roles and belongsTo Roles - class Role with hasMans User how can i get the roles belongs to a user, object user is given, how can i get objects in a many-to-many szanario? findByX doesn't work, it's affect just one table, but i need a "find" or something else to find Object overall / over many tables. can anyone help me? and excuse my no propper english^^

    Read the article

  • Grails: URL mapping - how to pass file extension ?

    - by Olexandr
    Hi. I have some folder with different files. I want to use something like this: http://myserver.com/foo/bar/test.html I'm using this way to obtain path: "/excursion/$path**" (controller:"excursion", action:"sweet") But it doesn't helps with file extensions... How to disable file extensions truncating ?

    Read the article

  • How to use more parameters in help-ballon grails-plugin

    - by servicesskurt
    I try to use more of the parameters but could not get it working with <g:helpBalloon title="foo" content="bla" useEvent="['mouseover']" /> should result in <script type="text/javascript"> new HelpBalloon({ title: 'foo', content: 'bla', useEvent: ['mouseover'] }); </script> but useEvent="['mouseover']" seems not to be recognized?! as seen on http://www.beauscott.com/examples/help_balloons/doc/examples.htm

    Read the article

  • Grails pattern to reuse template on error

    - by bsreekanth
    Hello, I have a gsp template, where the data for create view is passed through the controller. def create = { def bookInstance = new Book() bookInstance .properties = params def map = getDefaultValues() render(template: "create", model: [bookInstance : bookInstance , title: map.title, somelist: somelist ....]) the gsp template <g:select optionKey="id" from="${somelist}" name="somelist.id" value="${bookInstance ?.somelist?.id}" noSelection="['null': '']"></g:select> now, in the save method, if there is an error, it returns currently populated and validated instance (default scaffold implementation) render(template: "create", model: [bookInstance : bookInstance ]) But the fields in the gsp (error page rendered from save action) is empty. I could see the reason as it looks the value in "${somelist}" , but it is not used in save method. Do i just need to check for null in the gsp and use whichever map is available, or any better method (passing all the map in the save method is not an option) .. thanks in advance..

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >