This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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: 25461
180
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: 25461
180
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.
 
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic