aspose file tools*
The moose likes JSF and the fly likes Duplicate Component Id Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Duplicate Component Id" Watch "Duplicate Component Id" New topic
Author

Duplicate Component Id

Chris Voge
Ranch Hand

Joined: Jul 25, 2005
Posts: 34
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
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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.


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Duplicate Component Id