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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:01:22+00:00 2026-05-29T10:01:22+00:00

My question is similar to this following post Render a view of another controller

  • 0

My question is similar to this following post
Render a view of another controller

I have a TestConfigController my question is what can I do in case validation fails and I want to render controller:test and view:edit rather then controller:testCOnfig and view:edit

def save() {

        def testConfigInstance = new TestConfig(params)
        if (!testConfigInstance.save(flush: true)) {

/*Rather then view:”edit” i want view:”/test/edit” which does not work */

            render(view:"edit",  model: [testConfigInstance: testConfigInstance],id:params.test.id)
            return
        }
        println "+++++++++++++++++++++++++"
        flash.message = message(code: 'Data successfully saved', args: [message(code: 'testConfig.label', default: 'Successfully saved')])
        redirect(action: "edit", controller:"test", id:params.test.id)
    }

Any pointers? I have already looked into grails redirect which does not have “model” param and thus can not pass the validation errors to the view
Also I have looked in to grails render which does not have controller param so that I can go back to different controller!
Please let me know if more detail/code is needed

EDIT
Following happens while using one of the two things

render(view:"/test/edit",  model: [testConfigInstance: testConfigInstance],id:params['test.id'])

The code above renders the page /test/edit with no reference to testid eventually erroring out saying “test.id” can not be null.. (means its rendering /test/edit and not /test/edit/1)

render(view:"/test/edit/"+params['test.id'],  model: [testConfigInstance: testConfigInstance],id:params['test.id'])

The code above leads to following error

The requested resource (/EasyTha/WEB-INF/grails-app/views/test/edit/1.jsp) is not available.

Either one of the above code renders just “/test/edit” no id at the end, thus eventually erroring out saying test.id can not be null.

  • 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-29T10:01:23+00:00Added an answer on May 29, 2026 at 10:01 am

    The value of id that you are trying to append in the view path should be a part of the model map. The values that you provide in the model map are available in the view that is rendered.

    In the first option that you tried, the id parameter doesn’t make any difference as the render method doesn’t use any ‘id’ parameter (the redirect method uses the id parameter to generate the redirect url).

    Your code snippet should be something like this:

    render(view:"/test/edit",  model: [testConfigInstance: testConfigInstance, id:params['test.id']])
    

    The render method that you are using here doesn’t redirect you to some other action. render just prints the parsed viewName to the output stream. Eg. render(view:”/test/edit”) just renders the edit.gsp view. It isn’t actually redirecting you to the edit action of test controller. Therefore, just passing the id in the model map won’t give you access to the testInstance on the view. You will have to get the testInstance By id and pass it to the view in the model map

    render(view:"/test/edit",  model: [testConfigInstance: testConfigInstance, testInstance: Test.get(params['test.id'] as Long)])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is similar to another one, concerning pyCURL I have the following error
I have post the similar question before,but this time the problem is different,I got
Following on from this question about setting Culture, I have a similar issue with
Question similar to this: select from two tables where linked column can be null
I have a question similar to this: how to manually assign imagefield in Django
I have asked a question similar to this in the past but this is
I have a question regarding checkboxes. <form method=post> I speak the following languages: <input
Simple question. I have the following HTML: <a rel=nofollow id=claim-job-link data-method=post class=button green claim-job
Per this similar post , I tried the following but none-worked, with error noted
I'm looking for an answer to a question similar to this one: protect users'

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.