Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9196499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:51:48+00:00 2026-06-17T21:51:48+00:00

basically the domain to save not respect the floating point, as it makes it

  • 0

basically the domain to save not respect the floating point, as it makes it to another format

i have the next domain

class Location {
    double latitude
    double longitude
    static belongsTo=[ product: Product ]   
    static constraints = {      
        latitude nullable:false, blank:false
        longitude nullable:false, blank:false       
    }
}

view:

<g:form class="form-horizontal" action="create" id="${locationInstance?.product?.id}" >
    <fieldset>
        <f:with bean="locationInstance">
            <f:field property="lat"/>
            <f:field property="lon"/>
        </f:with>
    </fieldset>
</g:form>
<button type="button" class="submit btn btn-primary">
        <i class="icon-plus"></i>
        <g:message code="default.add.label" args="[message(code: 'location.label', default:'Location')]" default="Add Map"/>
</button>

controller:

import grails.converters.JSON
class LocationController {
    def create() {
    def model = [productInstance:Product.findByIdAndUser(params.remove("id"),negoexService.currentUser)]
    def responseReturn = [success:false]
    def redirectParams = [controller:"product", action:"list"]
    if (!model.productInstance) {
        responseReturn.message = message(code: "default.not.found.message", args: [message(code: "product.label", default: "Product"), params.id])
    }else{
        redirectParams.action = "edit"
        redirectParams.id = model.productInstance.id
        params.product = model.productInstance
        params.remove("action")
        params.remove("controller")
        model.locationInstance = new Location(params)
        println params // here are showed 29.089177 and -110.961227
        println model.locationInstance.lat // out is 2.9089177E7
        println model.locationInstance.lon // out is -1.10961227E8
        if(request.method=="POST"){
            if (model.locationInstance.save(flush: true)) {
                responseReturn.success = true
                responseReturn.message = message(code: "default.created.message", args: [message(code: "location.label", default: "Location"), model.locationInstance])
            }else{
                responseReturn.errors = model.locationInstance.errors.allErrors
            }
        }
    }
    withFormat {
        html {
            if(request.xhr && !model.productInstance){
                render view:"/messageAjax", model:responseReturn
            }else{
                if(responseReturn.message){flash.message = responseReturn.message}
                if(!model.productInstance || responseReturn.success){
                    redirect redirectParams
                }else{
                    render view:"create"+(request.xhr?"Ajax":""), model:model
                }
            }
        }
        json {render responseReturn as JSON}
        js   {render responseReturn as JSON}
        xml  {render responseReturn as XML}
    }
}

to request Location save()

the params arrive like params.latitude=29.089177 and params.longitude=-110.961227
after save the values are stored like locationInstance.latitude=29089177 and locationInstance.longitude=-110961227 in the data base.

To be showed in a view appears like latitude=2.9089177E7 and longitude=-1.10961227E8

what would be the problem, i have another project with theme class and run correctly.
and try changing the names of the properties and the type to float and not resolved

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:51:49+00:00Added an answer on June 17, 2026 at 9:51 pm

    just add this in conf/spring/resources.groovy

    beans = {
        localeResolver(org.springframework.web.servlet.i18n.SessionLocaleResolver) {
            defaultLocale = new Locale("es","MX")
            java.util.Locale.setDefault(defaultLocale)
        }
    } 
    

    to persist coordinates format, and that the values ​​are not changed when saving.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, I have an iframe of a page from another domain, and I want
In my domain I have something called Project which basically holds a lot of
Basically, if the URL/ window.location contains absolutely any variable whatsoever (past domain.com/, of course),
i have a 2 domain website. Basically, the 2 domains are for my multilanguage
With Grails, you have the save meta method attached to the Domain object. I
I have a Java\Spring\Hibernate application - complete with domain classes which are basically Hibernate
I have the following domain classes in my app class Video { private Image
I think i can simplify the problem domain. Basically i have set the preference
Basically, I have a directory that domain users need to have full access to.
I need to have 2 domain names that will basically be the same application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.