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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:17:34+00:00 2026-05-26T12:17:34+00:00

problem with redirection in a grails in a controller. in Controller: def function1 =

  • 0

problem with redirection in a grails in a controller.

in Controller:

    def function1 = {

        ... do stuff ...
        ... go to service ...

        redirect(action: "searchName", name: test)
        //redirect(action: "searchName", params: [ name: test ])
    }

in searchName, there are no parameters. its an empty list.
try the second way of calling the redirect and i get grails exceions (MissingMethodException), for a method that does exist.

there is nothing special that i can see, that is going on.

any help?

EDIT

the MissingMethodException is not on the searchName function, but on a method within the service. this method is there.

if i use the first redirect method, then the service method works correctly, but the redirect to searchName contains empty parameters.
if i switch the redirect method, then the service method no longer works
(with the exception, so it never gets to the redirect). with fully recompiled/cleaned code.

also, searchName is a closure. again, nothing fancy.
grab the name parameter, and work with it.

class MyWierdController {
def function1 = {
  ... do stuff ...
  ... go to service ...
  String test="blah"
  redirect(action: "searchName", name: test)
}

def searchName = {
  if (params.name) {
    log.info "its there"
  } else {
    log.info "its not there"
  }

}
}
  • 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-26T12:17:35+00:00Added an answer on May 26, 2026 at 12:17 pm

    redirect() is a real HTTP redirect. You will have issues, because all your params will be serialized an deserialized and probably you are losing type information (e.g. Date, which will be string after the redirect.

    The first version will ignore name parameter, since all parameters have to be within params.

    Try

    redirect(action: "searchName", params: ["name": "test"]);
    // or
    redirect(action: "searchName", params: params);
    

    Since you did not quoted the parameters, groovy expects them to be a variable and tries to resolve them. Since both are undefined it is becoming params: [null: null].

    However I guess, that you are searching for render(view: "searchName", params: ["name": "test"]), which will not do a HTTP redirect.

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

Sidebar

Related Questions

I an redirection (in some cases) from a controller to the error controller, action
The following htaccess based redirection rule works fine: Redirect 301 /content/category/2/24/30/ /new/c/url/ The problem
Problem (simplified to make things clearer): 1. there is one statically-linked static.lib that has
Have a very strange problem with Apache .htaccess URL Rewriting and Redirection. Here's my
I'm having a problem with php redirect (header) and mod_rewrite. Here is how: 1
hi all i have a redirection problem with mod ajp, that it always adds
I've created a Wix (3.0) custom action written in .NET. Fine. The problem is
I am having a big problem, I checked the redirection of my domain here
OK. I'm having a ridiculous problem. I'm trying to use URL rewrite to redirection
A problem I come up against again and again is handling redirection to the

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.