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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:24:39+00:00 2026-05-29T04:24:39+00:00

i have created new domain in grails and from a controller i’ve tried to

  • 0

i have created new domain in grails and from a controller i’ve tried to save but nothing get saved in the database.. the code is as follow

controller

     def register={
       String name = params.name
       String email = params.email
       String pass = params.password
       boolean signedIn = params.signedIn
       System.out.println(name + " " + email +" "+ pass+" " + signedIn)
       def rUser = new Registered(params)
      rUser.signedIn = signedIn

      System.out.println(rUser)
       rUser.save(flush:true)


   }

domain

    class Registered {
    String name;
    String email;
    String password;
    boolean signedIn =false;


    static constraints = {

    }
}

and i’m trying to save by this url

http://localhost:8080/egypths/apps/register?name=hegab&email=eio@gmail.com&password=tom&signedIn=false

so what am i doing wrong … putting in mind that there’s no error in the stack trace

  • 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-29T04:24:40+00:00Added an answer on May 29, 2026 at 4:24 am

    I would start by wrapping this in an integration test that would look like this:

    import groovy.util.GroovyTestCase
    import org.junit.Test
    
    public class RegisterControllerTests extends GroovyTestCase {
    
        @Test
        void saveAction() {
            def controller = new RegisterController() //or whatever the controller name is
            controller.params.name = "SomethingUnique"
            controller.params.email = "example@example.com"
            controller.params.password = "password"
            controller.params.signedIn = "false"
    
            controller.register()
    
            def registered = Registered.findByName("SomethingUnique")
            assert "example@example.com" == registered.email
            assert "password" == registered.password
            assert false == registered.signedIn
        }
    }
    

    Then I would start by making your controller action as simple as possible:

    def register={
        String name = params.name
        String email = params.email
        String pass = params.password
        boolean signedIn = params.signedIn
        def rUser = new Registered()
        rUser.name = name
        rUser.email = email
        rUser.password = pass
        rUser.signedIn = signedIn
    
        rUser.save(flush:true, failOnError:true)  //I would remove the failOnError after you identify the issue.
    }
    

    This way you can quickly repeat your test and figure out where your problem is. Adding the failOnError:true to the save call will cause an exception to be thrown if it doesn’t pass validation. If this simple example works start working back towards a more elegant solution to identify where you’re issue resides.

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

Sidebar

Related Questions

We have created a new List View Style that shows thumbnails from a picture
I'm just getting started with Groovy/Grails. I added a new domain controller to my
I'm struggling to get association right on Grails. Let's say I have two domain
I have created a heroku application and wants to give domain to it from
I have an application written in grails. I want to add a new domain
I have been working on test framework, which creates a new app domain to
I have created a new KeyListener, defined as following: ... public void keyTyped(KeyEvent arg0)
I have created a new JSP file called loggedOut.jsp and after I click logout
I have created a new solution with a minimal amount of code that represents
I have created a new SharePoint 2007 MOSS Intranet. Our admin people are purchasing

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.