• 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

line number for componentID?

 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.)
 
Saloon Keeper
Posts: 27763
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
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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

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

any ideas?
 
Tim Holloway
Saloon Keeper
Posts: 27763
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
I think you used the wrong link. That URL points back to this message thread.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic