• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

My own JSF component renders span after div when only div should be rendered. What's wrong?

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone!
I have created my first JSF component which should simply display a div element with some text inside. This is how I use it.

This is the component's class:


When I don't provide the id for the sf:hello compponent everything is rendered as expected:

The problem is when I provide the id for the element e.g.:

Suprisingly a span element is rendered after the div element

Why did this span alement appear there?
Thanks for help!
Saloon Keeper
Posts: 27797
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
It looks like the span was generated solely for the purpose of providing a place to hang the tag's id value. Which is a problem, since you already generated a tag with the same ID, thus violating the uniqueness requirement. The choice of "span" was undoubtedly because it's probably the only HTML wrapper that wouldn't alter the page layout.

I try to avoid doing custom JSF tags as Java code at the moment. I don't trust the mechanisms to remain stable. And it's easier to implement custom controls and the like as XML custom tags, instead. I recommend doing some serious manual reading, though. There's probably a way to switch off the automatic wrapper generation. Although the fact that the span follows your generated code instead of wrapping it probably indicates you haven't followed the protocols properly anyway.
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic