• 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

SimpleTagSupport and iteration

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi... all

I'm trying to use a custom-tag inside an iteration but the value-expression's value just won't make it through to the tag.

I followed the tutorial here:
http://www.ibm.com/developerworks/web/library/wa-aj-simplejava4.html

This is what the (interesting parts of the) iteration looks like:



For reasons that are too long to go into here both "performer.styles" and "styleSearch" are assigned by a servlet, the "styleSearch"-string makes it into the tag-class, but "style-name" just won't make it there. If I put in "styleSearch" for both "string" and "pattern" I get both strings into the tag-class.

The code for the tag-class is, more or less, copy-pasted from the ibm-tutorial.

I have also tried the same thing with <a4j:repeat> with the same, somewhat disappointing, result.

I haven't tried using <h:dataTable> as I've been putting a lot of work into a table-free layout (only some parts of the site is made in JSF) and I'd like to keep it that way.

Thanks for any advice.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a closer look at the article title. It says "Create JSF-like components". Not quite the same thing as creating JSF components!

My Mantra for the Month here on the JSF forum is "Don't Put Logic in the View". A JSF page is primarily about presentation of logical structure, so it works best in cases where the actual data and display control is done behind the scenes (in the backing bean). It's not that you can't embed straight HTML, JSP tags or JSTL in a JSF page, but you usually shouldn't and you should never be surprised when it doesn't co-operate. There's a completely different display paradigm in operation when you use JSF.

It's perfectly OK to mix JSF and non-JSF on a website (including both straight JSP and Struts). However, life will be more pleasant if you don't try and mix JSF and non-JSF strategies on the same page.

Don't avoid dataTables just because you don't want "tables". A dataTable is simply an abstract row-by-row view of a multi-row model built on the JSF data model class. How it actually comes out on the display end is a product of what type of renderer is in use and in the case of HTML rendering, the styles you apply to its display components.

Having preached my little sermon, however, it appears you're expecting to use the EL to do compound object references to a servlet and that would probably actually require mucking around in the beanUtils, which is more work than I'd want to put into it. It's easier and simpler to use a backing bean.
 
Stefan Anderssson
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your, excellent, reply.


Don't avoid dataTables just because you don't want "tables"



Personally, I don't mind tables that much (especially when you don't have to do the html yourself), but it's all about tableless designs these days and I try to comply with the standards. It really makes sense to try to stay away from tables though.

Umh, it isn't possible to render <h:dataTable>:s without the table tags, right?


However, life will be more pleasant if you don't try and mix JSF and non-JSF strategies on the same page.



I'm getting more and more aware of that now. I've tried to stay away from the servlets, but there are certain (javascript) things that I haven't been able to do with Richfaces so I headed back to prototype.js for those.

Thanks, again.

[ December 20, 2008: Message edited by: Stefan Anderssson ]
[ December 21, 2008: Message edited by: Stefan Anderssson ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic