Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Componentized logic in views - what to use.

 
Ari Kovak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64837
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tag files.
 
Ari Kovak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64837
86
IntelliJ IDE Java jQuery Mac Mac OS X
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic