• 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

Componentized logic in views - what to use.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm redesigning a few related views to reuse common components. Currently (in experimental phase) I'm using include actions, and passing pages parameters with request-scoped variables (so far: collections, strings and booleans). I'm not exactly happy with this, because it feels dirty.

A stripped example:
Because the parameters are request scoped, there's a chance of similarly named variables being contaminated or inadvertently re-used. So basically, I want to do it another way. After reading the Struts Tiles taglib documentation I couldn't find a way to pass collections as a parameter. Am I wrong? It appears you can pass pages, strings and definitions, but so far I haven't found a way to pass objects of other types. I suppose this goes beyong templating, which is what Tiles is trying to do. Even if it's misusing Tiles, it would have solved the scope issue.

I'm considering the include directive which would let me keep variables within the page scope and take away the need to pass them.

Also, custom tags. I personally don't want to develop custom tags to contain the limited logic that the components have. However, it is the cleanest solution I can think of.

Is there a method I'm missing? I welcome any advice as to which way to go.
 
Sheriff
Posts: 67749
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
Tag files.
 
Ari Kovak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
*googles*
Thanks, that's exactly what I was looking for. I didn't realize I could make custom tags using JSP fragments.
 
Bear Bibeault
Sheriff
Posts: 67749
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic