1

so I am trying to combine separate views of 4 grails application that I have.

So, I set about with combining two, I created two domain classes for the separate datasets, two controllers respectively. And now, I have 2 "index.gsp" which I have to combine basically.

I was thinking of having a basic hyperlink, of which one can go to "index.gsp"(Part 1) and the other to "index.gsp" (Part 2)

But, I am unable to find the URL to access multiple views.

I tried the following using : how can i render to the gsp view of other controller?

In index.gsp :

<g:link controller="ComController" action="redirect">Redirect to finalView.gsp </g:link>

In ComController :

def redirect = {
            redirect (controller:"PgtypController", action:"renderView")
            }

In PgtypController :

def renderView = {
    render(view:"pagetype");
    }

But, after clicking on "Redirect to finalView.gsp", I am getting an error :

HTTP Status 404 - /composite2/comController/redirect

type Status report

message /composite2/comController/redirect

description The requested resource is not available.

Also, in my views folder - I have "index.gsp" and "pagetype.gsp". When my app is running, I can view index.gsp - localhost:8080/composite2

How do I access "pagetype.gsp"?

All approaches/suggestions are most welcome to access multiple views here

Community
  • 1
  • 1
Pravin
  • 461
  • 5
  • 26
  • try using something other than 'redirect' as your action/method name in your controller. I suspect that's the issue. The reason being redirect is already a method added to Controllers by Grails and you are redefining it. So use def doMyRedirect = { ... } However, that said ... when you say you want to combine views do you want to have one page that includes both without having to link to the second? If so that's best done using g:include and including the second view. – Joshua Moore Aug 12 '14 at 08:32
  • So I changed it to "doMyRedirect" and still getting the same error again. I want to hyperlink the different views and no show all of them together. How do I go about doing this? What am I doing wrong here? – Pravin Aug 12 '14 at 08:59

0 Answers0