File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Titan Faces
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • 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:

Taglib

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!
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17627
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic