0

This is a continuation to the question : Grails multiple views implementation

I am trying to combine two grails application ( 2 domains combined, 2 controllers combined, 2 views NOT able to combine)

So, I tried various code snippets with "g:link" which are not working still. I have two views : "index.gsp" & "pagetype.gsp". I want to display "index.gsp" first and then after clicking on a hyperlink it should go to "pagetype.gsp" How do I do this?

I tried as follows: Now, I went into "UrlMappings.groovy" and understood how the main index.gsp is accessed by this line :

"/"(view:"/index")

This is the default view, so I changed this to :

"/"(view:"/pagetype")

And now, it loads the second view as the default view successfully.

But, I want the "pagetype.gsp" to be loaded after clicking on a hyperlink so I tried :

"/."(view:"/pagetype")

And in index.gsp code :

<a href="/." class="myButton">Pagetype view</a>

But, this is not working.

All approaches/suggestions are most welcome.

Community
  • 1
  • 1
Pravin
  • 461
  • 5
  • 26

1 Answers1

1

Add link in gsp like:

<a href="pagetype">Click Here</a>

and update UrlMappings:

"/"(view:"/index")
"/pagetype"(view:"/pagetype")

assuming you have pagetype.gsp in parallel of index.gsp in views.

MKB
  • 7,587
  • 9
  • 45
  • 71
  • Thanks a lot mate, this worked perfectly!! I can merge x number of apps using this concept now. – Pravin Aug 14 '14 at 11:52