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 7187319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:49:09+00:00 2026-05-28T18:49:09+00:00

New to Grails and this may be simple problem. I am trying to save

  • 0

New to Grails and this may be simple problem.

I am trying to save some values to database, so I created a simple form with two text fields and a button in GSP (info.gsp). When button (update) is pressed it calls method update() on the controller & saves the change. Good till here.

And I want to show “saved ” on the same gsp (info.gsp) with the saved new values. render takes me to a new page.

Please help how to do it.

thanks
Sana

  • 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-05-28T18:49:10+00:00Added an answer on May 28, 2026 at 6:49 pm

    On the action that is saving your object render the value you want to display for example

        def save() {
           println params
           def bookInstance = new Book(params)
           if (!bookInstance.save(flush: true)) {
              render "not saved"
           }
           flash.message = message(code: 'default.created.message', args: [message(code: 'book.label', default: 'Book'), bookInstance.id])
           render bookInstance.id // "saved!!!!"
    }
    

    and on your view update a placeholder using its ID. In my example, submitToRemote has a update attribute that will take care of it. Hope this code helps

    <html>
    <head>
        <title>Page Title</title>
        <meta name="layout" content="main"/>
        <r:require modules="jquery"/>
        <g:javascript library="application" /> 
        <modalbox:modalIncludes />
    </head>
    <body>
        <g:form name="myform" action='save'>
                book: <input name="name" type="text" />
                <g:submitToRemote action='save' update="updateMe" name="myname"/>
        </g:form>
        <div id="updateMe">
        </div>
    </<body>
    

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

Sidebar

Related Questions

This may be a basic question but I am new to grails and tried
I am trying to add data to a database, in grails but get this
I am new to using Grails plugins and this is most likely a novice
I'm new to Grails development. I have a domain class like this : class
I've created a domain class in Grails like this: class MyObject { static hasMany
I'm trying to follow the grails tutorial here . When I create a new
I do have this code on my demo.gsp file. But I´m new to grails
Im new to grails and I try to get a database entry. The database
I am creating a new Grails project that uses some Java code to do
when i check out a new grails project from svn, i got some error:

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.