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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:44:30+00:00 2026-05-21T05:44:30+00:00

In my controller class have the following code class MyController { def flickrService def

  • 0

In my controller class have the following code

class MyController {

    def flickrService

    def index = {
        def data = flickrService.search {
            tags 'tag,tag2,tag3'
            page 3
            perPage 14 // Look ma!
        }
        [urls:data.urls,page:data.page,pages:data.pages]
    }

}

I have also created an index.gsp file.
As I am new to groovy grails – i could not figure it out how to access data returned by flickrservice in the view. Can I just access “data” defined above in the index view or I need to set it in the controller before I can loop through the returned data? Any help would be highly appreciated. 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-05-21T05:44:31+00:00Added an answer on May 21, 2026 at 5:44 am

    Yes, now you can access data from the view, for example,in index.gsp:

    <html><head>Test</head><body>${urls} <br/> ${page} </body></html>
    

    Generally saying, grails return the last value in function by default, so if you want to access many data, you can do like this:

    class MyController {
    
        def flickrService
    
        def index = {
            def data = ...
            def data1 = ...
            def data2 = ...
    
            // Here's the return result:
                [view_data:data,view_data1:data1, view_data2:data2]
        }
    
    }
    

    Then you can access ${view_data},${view_data1},${view_data2} in view.

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

Sidebar

Related Questions

No related questions found

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.