• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Composite View

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a problem with understanding the composite view. I use struts 2.0 for my FrontController and I want now that my pages have a template index.jsp (header, navigation, main) and that load automatically the right content. On the website http://www.oracle.com/technetwork/java/compositeview-138350.html I found a brief description of Composite Views but I don't understand it completly, I think.

My Website Environment:
- Tomcat 6.0.29
- Eclipse Java EE Helios
- Struts 2.2.1

This is how I made my Website:

I have a LoadAction which i must give the parameter "main" that it sets the attribute "main" and forwards it to my index.jsp which than includes the the value of the "main" attribute.

index.jsp file:


My LoadAction.java:


This my navigation.jsp which till now only inherits one link to load my createTerm.jsp:


But I think this is not a good solution? Very bad performance...even when I make some approaches. Is there a better solution to load dynamically (with a navigation) content in my template index.jsp? And the main question have I implemented the Composite View correctly?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not at all clear to me what you're doing (besides that you say you're using both S2.0 and S2.1.1, but your code is Struts 1).

Let's straighten that little issue out first before we get into the fact that Struts already *is* a controller, and you're introducing an unnecessary layer on top of it, and badly, since you're coding direct references to pages, and page types, in your Java.
 
Matthias Zeilerbauer
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:It's not at all clear to me what you're doing (besides that you say you're using both S2.0 and S2.1.1, but your code is Struts 1).

Let's straighten that little issue out first before we get into the fact that Struts already *is* a controller, and you're introducing an unnecessary layer on top of it, and badly, since you're coding direct references to pages, and page types, in your Java.



I must admit that I have not much experience with struts. But I downloaded struts 2.2.1 and so I wrote that as my environment. What would be the diffrence? Because I don't want to learn old technologies, expect the new one is build up on it.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are entirely different frameworks.
 
Matthias Zeilerbauer
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:They are entirely different frameworks.



Ok then I will search for another solution (struts 2.2.1). But one more question can I make with struts 2.2.0 (I mean has struts 2.2.0 support for) custom tags composite view? Because I didn't find anything about it. (or oversaw it)
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Custom tag support is completely unrelated to backing framework. S2 supports Tiles, SiteMesh, standard JSTL page composition, and so on.

But it's still not clear to me what you're trying to do.
 
Matthias Zeilerbauer
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to implement "custom" tag composite view in my Website. I know that a backing framework has nothing todo with custom tags. My question is if the backing framework (struts 2.2.1) has a solution (tags or something) which i can use to implement my composite view. Custom tags is maybe the wrong expression because they are implemented in the framework...sorry that was unclearly explained. I had that expression from "http://java.sun.com/blueprints/corej2eepatterns/Patterns/CompositeView.html" and I don't know a better expression because composite view can be also the very unflexible way of JSTL (with <jsp:include). So my really question is if there is a more flexible one with struts 2.2.1?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I already said that Struts supports both Tiles and SiteMesh. And I think you're prematurely discounting smart usage of c:import and the like, which is a very lightweight way to composite views. I'm not sure what else to tell you.
 
Matthias Zeilerbauer
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No ok, thanks thats perfect. Now I will try a little.
Thanks
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic