You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rave.apache.org by Ankur Goyal <as...@umail.iu.edu> on 2012/01/03 20:39:19 UTC

A question on the design pattern used for jsp pages and tile defination

Hi,

While I was going through some of the jsp pages (to get some hints and
coding style of others for the user profile I am working on) I noticed some
things :-

-> *tiles-defs.xml*
    has a base template definition and other definition extend on this but
I found that there is no header jsp files or footer jsp files present in
code base for each of the display web page (except for a blank header.jsp)

-> for example in file *page.jsp, *it has a header tag which I feel must
have been a seperate jsp file of its own (considering the tiles-defs.xml
file definitions)

-> Also there is a file called *base_layout.jsp *which is the common call
for all display pages and here the appropriate tile definition is imported
for displaying. So it has the header definition, body definition and footer
definition inserted.

So looking at the pattern of xml and base_layout file, is it that the
header should be in a separate file (for example for page.jsp header tag
should be in a different header file)?

Also a thought, why not just have the base template with the attributes:-
- header
- menu (which may be needed in user profile page)
- body
- footer

and remove the other template definitions.

The value of all these definitions can be overrided as and when needed
based on what to display.

I apologize if I wrote a wrong explanation of code base.

Would be happy to know more and receive comments. :)

Waiting for replies.

Regards,
Ankur

Re: A question on the design pattern used for jsp pages and tile defination

Posted by Ankur Goyal <as...@umail.iu.edu>.
Thanks! I understood about the header and footer now :)

Well about the last part of having a common base template definition, I was
thinking something like having all the attributes:-

>- header
>- menu (which may be needed in user profile page)
>- body
>- footer

in the base template and like other templates will just extend it (sorry I
misunderstood their presence earlier, your explanation made it so clear now
:) )

So, just a thought of mine, we can have a class pojo file which can have a
property like "jsp type". This can be set in the appropriate controller
call and can be passed as a model to the base_layout.jsp where we can have
conditions  to check its type and override the template attributes
accordingly.

Its just a thought. I may be wrong of what I said but just wanted to share.

Thanks a lot for your wonderful explanation! It will help me a lot. :)

Regards,
Ankur

On Wed, Jan 4, 2012 at 10:54 AM, Ciancetta, Jesse E. <jc...@mitre.org>wrote:

> >-----Original Message-----
> >From: Ankur Goyal [mailto:asgoyal@umail.iu.edu]
> >Sent: Tuesday, January 03, 2012 2:39 PM
> >To: rave
> >Subject: A question on the design pattern used for jsp pages and tile
> >defination
> >
> >Hi,
> >
> >While I was going through some of the jsp pages (to get some hints and
> >coding style of others for the user profile I am working on) I noticed
> some
> >things :-
> >
> >-> *tiles-defs.xml*
> >    has a base template definition and other definition extend on this but
> >I found that there is no header jsp files or footer jsp files present in
> >code base for each of the display web page (except for a blank header.jsp)
>
> There are both header.jsp and footer.jsp files already defined and
> referenced by the base template, however they are currently both just blank
> files.
>
> The reason why the header is blank currently is because we don’t really
> have a common header currently.  The top of every page has a header of
> sorts with navigation and such, but right now it's pretty specific to each
> class of page (admin, gadget repository, portal page, ...) so there really
> isn’t any common header to share right now.  I'd like to spend some time
> looking at how the current top navigation bar is implemented and thinking
> about how we might be able to make it generic enough to share across all
> pages as a common header but haven’t yet had the time.
>
> The footer is blank currently but is being included on all pages -- feel
> free to go ahead and add some content to it (maybe the Rave version or
> something just so we can see that it is there).
>
> >-> for example in file *page.jsp, *it has a header tag which I feel must
> >have been a seperate jsp file of its own (considering the tiles-defs.xml
> >file definitions)
>
> That’s the current navigation top bar I was referring to above -- right
> now it isn’t common enough to just share across all pages in the current
> header.jsp file, but it would be nice if we found a way to make it so.
>
> >-> Also there is a file called *base_layout.jsp *which is the common call
> >for all display pages and here the appropriate tile definition is imported
> >for displaying. So it has the header definition, body definition and
> footer
> >definition inserted.
>
> Right -- that one layout defines the layout for the entire application.
>  One change there would make a sweeping change across all pages.
>
> >So looking at the pattern of xml and base_layout file, is it that the
> >header should be in a separate file (for example for page.jsp header tag
> >should be in a different header file)?
>
> Again -- it would be nice to get that code into the existing header.jsp,
> but work would need to be done to come up with a common enough way to do it
> (since header.jsp is shared across all pages).
>
> >Also a thought, why not just have the base template with the attributes:-
> >- header
> >- menu (which may be needed in user profile page)
> >- body
> >- footer
> >
> >and remove the other template definitions.
>
> Adding a menu tile to the base layout may make sense (depending on what we
> come up with for a common menu design), but I'm not sure what you mean
> about removing other definitions.
>
> The "templates.base" definition is the base definition for the entire
> application.
>
> The "templates.user.page.*" definition extends the base and is the basis
> of all widget rendering pages (the wildcard is used to select the
> appropriate view to use for rendering the widgets -- columns_1.jsp,
> columns_2.jsp, ...).
>
> The "templates.user.*" definition extends the base and is the basis of all
> non-widget rendering user facing pages (the wildcard is used to select the
> appropriate view to use for rendering the page -- store.jsp, widget.jsp,
> ...).
>
> And finally the "templates.admin.*" definition extends the base and is the
> basis of all admin facing pages and works the same way that the
> "templates.user.*" definition does (in terms of the wildcard being used to
> select the jsp).
>
> >
> >The value of all these definitions can be overrided as and when needed
> >based on what to display.
> >
> >I apologize if I wrote a wrong explanation of code base.
> >
> >Would be happy to know more and receive comments. :)
> >
> >Waiting for replies.
> >
> >Regards,
> >Ankur
>

RE: A question on the design pattern used for jsp pages and tile defination

Posted by "Ciancetta, Jesse E." <jc...@mitre.org>.
>-----Original Message-----
>From: Ankur Goyal [mailto:asgoyal@umail.iu.edu]
>Sent: Tuesday, January 03, 2012 2:39 PM
>To: rave
>Subject: A question on the design pattern used for jsp pages and tile
>defination
>
>Hi,
>
>While I was going through some of the jsp pages (to get some hints and
>coding style of others for the user profile I am working on) I noticed some
>things :-
>
>-> *tiles-defs.xml*
>    has a base template definition and other definition extend on this but
>I found that there is no header jsp files or footer jsp files present in
>code base for each of the display web page (except for a blank header.jsp)

There are both header.jsp and footer.jsp files already defined and referenced by the base template, however they are currently both just blank files.

The reason why the header is blank currently is because we don’t really have a common header currently.  The top of every page has a header of sorts with navigation and such, but right now it's pretty specific to each class of page (admin, gadget repository, portal page, ...) so there really isn’t any common header to share right now.  I'd like to spend some time looking at how the current top navigation bar is implemented and thinking about how we might be able to make it generic enough to share across all pages as a common header but haven’t yet had the time.

The footer is blank currently but is being included on all pages -- feel free to go ahead and add some content to it (maybe the Rave version or something just so we can see that it is there).

>-> for example in file *page.jsp, *it has a header tag which I feel must
>have been a seperate jsp file of its own (considering the tiles-defs.xml
>file definitions)

That’s the current navigation top bar I was referring to above -- right now it isn’t common enough to just share across all pages in the current header.jsp file, but it would be nice if we found a way to make it so.

>-> Also there is a file called *base_layout.jsp *which is the common call
>for all display pages and here the appropriate tile definition is imported
>for displaying. So it has the header definition, body definition and footer
>definition inserted.

Right -- that one layout defines the layout for the entire application.  One change there would make a sweeping change across all pages.

>So looking at the pattern of xml and base_layout file, is it that the
>header should be in a separate file (for example for page.jsp header tag
>should be in a different header file)?

Again -- it would be nice to get that code into the existing header.jsp, but work would need to be done to come up with a common enough way to do it (since header.jsp is shared across all pages).

>Also a thought, why not just have the base template with the attributes:-
>- header
>- menu (which may be needed in user profile page)
>- body
>- footer
>
>and remove the other template definitions.

Adding a menu tile to the base layout may make sense (depending on what we come up with for a common menu design), but I'm not sure what you mean about removing other definitions.  

The "templates.base" definition is the base definition for the entire application.

The "templates.user.page.*" definition extends the base and is the basis of all widget rendering pages (the wildcard is used to select the appropriate view to use for rendering the widgets -- columns_1.jsp, columns_2.jsp, ...).

The "templates.user.*" definition extends the base and is the basis of all non-widget rendering user facing pages (the wildcard is used to select the appropriate view to use for rendering the page -- store.jsp, widget.jsp, ...).

And finally the "templates.admin.*" definition extends the base and is the basis of all admin facing pages and works the same way that the "templates.user.*" definition does (in terms of the wildcard being used to select the jsp).

>
>The value of all these definitions can be overrided as and when needed
>based on what to display.
>
>I apologize if I wrote a wrong explanation of code base.
>
>Would be happy to know more and receive comments. :)
>
>Waiting for replies.
>
>Regards,
>Ankur