Quantcast

Many gsp pages in one view page

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Many gsp pages in one view page

kumudu

In my project i need to view information shown in several show.gsp pages of several domain classes in a one(single)  page.
 Is it possible.

regards.
kumudu



Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Many gsp pages in one view page

Konstantyn Smirnov
You must define those pages or their parts as templates, and include them in that "big page"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Many gsp pages in one view page

Dave Klein-2
In reply to this post by kumudu
You can show as many different objects on a page as you need to.  You just have to pass them in from the controller.  So, in your controller you can have an action like this:

def bigpage = {
   def foo = Foo.get(x)
   def bar = Bar.get(y)
   def baz = Baz.get(z)

    [foo:foo, bar:bar, baz:baz]
}

Then in your bigpage.gsp you could do something like this:

<div id=foodiv>
  foo.property1 <br/>
  foo.property2 <br/>
  foo.property3
</div>

<div id=bardiv>
  ...
</div>

<div bazdiv>
  ...
</div>

Or whatever layout you like.  You could also do this with templates, as Konstantyn suggested, but you will still need the objects in the model coming from the controller.

Hope that helps,
Dave


On Mon, Jan 5, 2009 at 6:11 AM, kumudu Samarappuli <[hidden email]> wrote:

In my project i need to view information shown in several show.gsp pages of several domain classes in a one(single)  page.
 Is it possible.

regards.
kumudu



Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Many gsp pages in one view page

kumudu
What do you mean by foo, Foo,  x, property 1 in u'r code.
 In my project i  have contactInformation domain class. From its show.gsp I  need to view show gsp's of coordinator and itAdministrator.  My domain classes are as follows.

class ContactInformation {

        Organization organization
   
   
    static hasMany =[coordinators:Coordinator,itAdministratorInformations:ItAdministratorInformation,
                        chiefInnovationOfficers:ChiefInnovationOfficer]
    String toString(){return 'Contact Information of- '+ organization}
    static belongsTo = Organization

    static constraints = {
        organization()
        coordinators()
        itAdministratorInformations()
        chiefInnovationOfficers()

    }
}


class Coordinator extends SystemUser{

    ContactInformation contactInformation
        String organizationAddress
        String telephoneNo
        String mobileNo
        String homeTelephoneNo
        String fax

    String toString(){return 'Coordinator -'+ name}


        static belongsTo = ContactInformation
        static constraints = {      
       
        organizationAddress(blank:false)
        telephoneNo(matches:"[0-9]+")

        mobileNo(matches:"[0-9]+")
        homeTelephoneNo(matches:"[0-9]+")
        fax(matches:"[0-9]+")
        contactInformation()

    }
}


class ItAdministratorInformation extends SystemUser{

    ContactInformation contactInformation
 
        String telephoneNo
    String mobileNo
        String homeTelephoneNo

    String toString(){return 'IT Administrator - '+name}

        static belongsTo =  ContactInformation
        static constraints = {

        telephoneNo(matches:"[0-9]+")
        mobileNo(matches:"[0-9]+")
        homeTelephoneNo(matches:"[0-9]+")
        contactInformation()

    }
}

class SystemUser {

        String name
        String designation
        String emailAddress
        String VOIP
   
        String toString(){return ' System users -'+ name +' -'+designation}

 
        static belongsTo = Organization

        static constraints={

                name(blank:false)
                designation(blank:false)
                emailAddress(email:true)
                VOIP()
     
    }

}



Dave Klein-2 wrote
You can show as many different objects on a page as you need to.  You just
have to pass them in from the controller.  So, in your controller you can
have an action like this:

def bigpage = {
   def foo = Foo.get(x)
   def bar = Bar.get(y)
   def baz = Baz.get(z)

    [foo:foo, bar:bar, baz:baz]
}

Then in your bigpage.gsp you could do something like this:

<div id=foodiv>
  foo.property1 <br/>
  foo.property2 <br/>
  foo.property3
</div>

<div id=bardiv>
  ...
</div>

<div bazdiv>
  ...
</div>

Or whatever layout you like.  You could also do this with templates, as
Konstantyn suggested, but you will still need the objects in the model
coming from the controller.

Hope that helps,
Dave


On Mon, Jan 5, 2009 at 6:11 AM, kumudu Samarappuli <kumuduharshani@yahoo.com
> wrote:

>
> In my project i need to view information shown in several show.gsp pages of
> several domain classes in a one(single)  page.
>  Is it possible.
>
> regards.
> kumudu
>
>
> ------------------------------
>  Get your preferred Email name!
> <http://sg.rd.yahoo.com/aa/mail/domainchoice/mail/signature/*http://mail.promotions.yahoo.com/newdomains/aa/>
> Now you can @ymail.com and @rocketmail.com.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Many gsp pages in one view page

kumudu
In reply to this post by Konstantyn Smirnov
Can you please explain it with an example , please.

regards.
kumudu

--- On Mon, 5/1/09, Konstantyn Smirnov <[hidden email]> wrote:
From: Konstantyn Smirnov <[hidden email]>
Subject: Re: [grails-user] Many gsp pages in one view page
To: [hidden email]
Date: Monday, 5 January, 2009, 3:07 PM

You must define those pages or their parts as templates, and include them in
that "big page"
--
View this message in context:
http://www.nabble.com/Many-gsp-pages-in-one-view-page-tp21289959p21292635.html
Sent from the grails - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Many gsp pages in one view page

Konstantyn Smirnov
read this
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Many gsp pages in one view page

Dave Klein-2
In reply to this post by kumudu
In my example I was just using placeholders since I did not know what your domain model looked like.  Foo (uppercase 1st character) is a class, foo (lowercase 1st character) is a variable of type Foo. x is any number representing a valid id of a domain class and property1 represents any property of the class in question. 

For your code, since the other objects you need are in a relationship with main object you can do something like this in your contactInformation show.gsp:

<g:each in="${contactInformationInstance.coordinators} var="coordinator">
  //Within this g:each block you can put any information about the coordinator that you need.  You can just copy the code from a generated Coordinator show page.
</g:each>

Then you can do the same with the itAdministrator. 

I hope that's a little clearer.

Dave

On Mon, Jan 5, 2009 at 9:58 PM, kumudu <[hidden email]> wrote:

What do you mean by foo, Foo,  x, property 1 in u'r code.
 In my project i  have contactInformation domain class. From its show.gsp I
need to view show gsp's of coordinator and itAdministrator.  My domain
classes are as follows.

class ContactInformation {

       Organization organization


   static hasMany
=[coordinators:Coordinator,itAdministratorInformations:ItAdministratorInformation,
                       chiefInnovationOfficers:ChiefInnovationOfficer]
   String toString(){return 'Contact Information of- '+ organization}
   static belongsTo = Organization

   static constraints = {
       organization()
       coordinators()
       itAdministratorInformations()
       chiefInnovationOfficers()

   }
}


class Coordinator extends SystemUser{

   ContactInformation contactInformation
       String organizationAddress
       String telephoneNo
       String mobileNo
       String homeTelephoneNo
       String fax

   String toString(){return 'Coordinator -'+ name}


       static belongsTo = ContactInformation
       static constraints = {

       organizationAddress(blank:false)
       telephoneNo(matches:"[0-9]+")

       mobileNo(matches:"[0-9]+")
       homeTelephoneNo(matches:"[0-9]+")
       fax(matches:"[0-9]+")
       contactInformation()

   }
}


class ItAdministratorInformation extends SystemUser{

   ContactInformation contactInformation

       String telephoneNo
   String mobileNo
       String homeTelephoneNo

   String toString(){return 'IT Administrator - '+name}

       static belongsTo =  ContactInformation
       static constraints = {

       telephoneNo(matches:"[0-9]+")
       mobileNo(matches:"[0-9]+")
       homeTelephoneNo(matches:"[0-9]+")
       contactInformation()

   }
}

class SystemUser {

       String name
       String designation
       String emailAddress
       String VOIP

       String toString(){return ' System users -'+ name +' -'+designation}


       static belongsTo = Organization

       static constraints={

               name(blank:false)
               designation(blank:false)
               emailAddress(email:true)
               VOIP()

   }

}




Dave Klein-2 wrote:
>
> You can show as many different objects on a page as you need to.  You just
> have to pass them in from the controller.  So, in your controller you can
> have an action like this:
>
> def bigpage = {
>    def foo = Foo.get(x)
>    def bar = Bar.get(y)
>    def baz = Baz.get(z)
>
>     [foo:foo, bar:bar, baz:baz]
> }
>
> Then in your bigpage.gsp you could do something like this:
>
> <div id=foodiv>
>   foo.property1 <br/>
>   foo.property2 <br/>
>   foo.property3
> </div>
>
> <div id=bardiv>
>   ...
> </div>
>
> <div bazdiv>
>   ...
> </div>
>
> Or whatever layout you like.  You could also do this with templates, as
> Konstantyn suggested, but you will still need the objects in the model
> coming from the controller.
>
> Hope that helps,
> Dave
>
>
> On Mon, Jan 5, 2009 at 6:11 AM, kumudu Samarappuli
> <[hidden email]
>> wrote:
>
>>
>> In my project i need to view information shown in several show.gsp pages
>> of
>> several domain classes in a one(single)  page.
>>  Is it possible.
>>
>> regards.
>> kumudu
>>
>>
>> ------------------------------
>>  Get your preferred Email name!
>> <http://sg.rd.yahoo.com/aa/mail/domainchoice/mail/signature/*http://mail.promotions.yahoo.com/newdomains/aa/>
>> Now you can @ymail.com and @rocketmail.com.
>
>

--
View this message in context: http://www.nabble.com/Many-gsp-pages-in-one-view-page-tp21289959p21304330.html
Sent from the grails - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Many gsp pages in one view page

kumudu
Thanks a lot. It works fine



Dave Klein-2 wrote
In my example I was just using placeholders since I did not know what your
domain model looked like.  Foo (uppercase 1st character) is a class, foo
(lowercase 1st character) is a variable of type Foo. x is any number
representing a valid id of a domain class and property1 represents any
property of the class in question.

For your code, since the other objects you need are in a relationship with
main object you can do something like this in your contactInformation
show.gsp:

<g:each in="${contactInformationInstance.coordinators} var="coordinator">
  //Within this g:each block you can put any information about the
coordinator that you need.  You can just copy the code from a generated
Coordinator show page.
</g:each>

Then you can do the same with the itAdministrator.

I hope that's a little clearer.

Dave

On Mon, Jan 5, 2009 at 9:58 PM, kumudu <kumuduharshani@yahoo.com> wrote:

>
> What do you mean by foo, Foo,  x, property 1 in u'r code.
>  In my project i  have contactInformation domain class. From its show.gsp I
> need to view show gsp's of coordinator and itAdministrator.  My domain
> classes are as follows.
>
> class ContactInformation {
>
>        Organization organization
>
>
>    static hasMany
>
> =[coordinators:Coordinator,itAdministratorInformations:ItAdministratorInformation,
>                        chiefInnovationOfficers:ChiefInnovationOfficer]
>    String toString(){return 'Contact Information of- '+ organization}
>    static belongsTo = Organization
>
>    static constraints = {
>        organization()
>        coordinators()
>        itAdministratorInformations()
>        chiefInnovationOfficers()
>
>    }
> }
>
>
> class Coordinator extends SystemUser{
>
>    ContactInformation contactInformation
>        String organizationAddress
>        String telephoneNo
>        String mobileNo
>        String homeTelephoneNo
>        String fax
>
>    String toString(){return 'Coordinator -'+ name}
>
>
>        static belongsTo = ContactInformation
>        static constraints = {
>
>        organizationAddress(blank:false)
>        telephoneNo(matches:"[0-9]+")
>
>        mobileNo(matches:"[0-9]+")
>        homeTelephoneNo(matches:"[0-9]+")
>        fax(matches:"[0-9]+")
>        contactInformation()
>
>    }
> }
>
>
> class ItAdministratorInformation extends SystemUser{
>
>    ContactInformation contactInformation
>
>        String telephoneNo
>    String mobileNo
>        String homeTelephoneNo
>
>    String toString(){return 'IT Administrator - '+name}
>
>        static belongsTo =  ContactInformation
>        static constraints = {
>
>        telephoneNo(matches:"[0-9]+")
>        mobileNo(matches:"[0-9]+")
>        homeTelephoneNo(matches:"[0-9]+")
>        contactInformation()
>
>    }
> }
>
> class SystemUser {
>
>        String name
>        String designation
>        String emailAddress
>        String VOIP
>
>        String toString(){return ' System users -'+ name +' -'+designation}
>
>
>        static belongsTo = Organization
>
>        static constraints={
>
>                name(blank:false)
>                designation(blank:false)
>                emailAddress(email:true)
>                VOIP()
>
>    }
>
> }
>
>
>
>
> Dave Klein-2 wrote:
> >
> > You can show as many different objects on a page as you need to.  You
> just
> > have to pass them in from the controller.  So, in your controller you can
> > have an action like this:
> >
> > def bigpage = {
> >    def foo = Foo.get(x)
> >    def bar = Bar.get(y)
> >    def baz = Baz.get(z)
> >
> >     [foo:foo, bar:bar, baz:baz]
> > }
> >
> > Then in your bigpage.gsp you could do something like this:
> >
> > <div id=foodiv>
> >   foo.property1 <br/>
> >   foo.property2 <br/>
> >   foo.property3
> > </div>
> >
> > <div id=bardiv>
> >   ...
> > </div>
> >
> > <div bazdiv>
> >   ...
> > </div>
> >
> > Or whatever layout you like.  You could also do this with templates, as
> > Konstantyn suggested, but you will still need the objects in the model
> > coming from the controller.
> >
> > Hope that helps,
> > Dave
> >
> >
> > On Mon, Jan 5, 2009 at 6:11 AM, kumudu Samarappuli
> > <kumuduharshani@yahoo.com
> >> wrote:
> >
> >>
> >> In my project i need to view information shown in several show.gsp pages
> >> of
> >> several domain classes in a one(single)  page.
> >>  Is it possible.
> >>
> >> regards.
> >> kumudu
> >>
> >>
> >> ------------------------------
> >>  Get your preferred Email name!
> >> <
> http://sg.rd.yahoo.com/aa/mail/domainchoice/mail/signature/*http://mail.promotions.yahoo.com/newdomains/aa/
> >
> >> Now you can @ymail.com and @rocketmail.com.
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Many-gsp-pages-in-one-view-page-tp21289959p21304330.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>
Loading...