• 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

Duplicate Component Id

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just wanted to share how I fixed a
"Duplicate Component Id" error I was receiving.

From the research I did, all JSF components are
kept in a component tree with all the ID's preserved
from page to page. When I was dynamically adding
a new SelectItem to a SelectOneMenu, it was trying
to assign an Id that was already on the component
tree.

I discovered a method called setTransient(boolean)
that controls whether to either preserve my Faces
jsp pages and or basically load the page from scratch
assigning new Id's to whatever components are loaded.
A value of false loads the page from scratch.

I hope this all makes sense.

It was pain to resolve, but it made me feel good

Chris
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just on a related note, aside from it's method in JSF you can use the transient keyword on any property of a persisted object to keep that property from being persisted. For example



If you persist this class in any way, the password does not get persisted with it. So that is, in escence, what that method is doing for you.
 
What could go wrong in a swell place like "The Evil Eye"? Or with this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic