Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

line number for componentID?  RSS feed

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I obtain the actual lineNumber of the JSF-Tree to insert it into my component-ID?

I get the failure "duplicate Id for a component" and want to set it via EL something like:

<h:inputText id="#{thisID}_#{lineNumber}" ../>

(I use c:forEach to build my component-tree and use ajax, with ui:repeat, I cannot have the same effect as with c:forEach.)
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Line numbers are not considered significant in JSF. I thing you mean something more like item number here.

The rules are completely different for JSF than JSTL. If you're trying to get the same effect using ui:repeat, all you should need is just 'id="1234"'. The JSF framework will add extra layers to the generated ID to make it unique. However, I recommend you look at the displayed HTML after you do that so you can see how it's synthesizing the ID, since if you plan to reference it with your own JavaScript code, you'll need the full (generated) ID, not just the ID you code in the JSF.

I hope you're not really mixing JSTL and JSF here. JSTL on JSF pages is trouble at the best of times.
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mix a little bit JSTL with JSF when it comes to dynamic component building.

I made the experience, that ui:repeat not always works for component buildung. c:forEach always works. (I know the difference between the both).

But I have to use c:forEach.

I red the topic

http://www.coderanch.com/t/214729/JSF/java/line-number-componentID
and wonder how provide such line-numbers in an component ID.

any ideas?
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you used the wrong link. That URL points back to this message thread.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!