The moose likes JSF and the fly likes Custom component & validation/rendering problems Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Custom component & validation/rendering problems" Watch "Custom component & validation/rendering problems" New topic
Author

Custom component & validation/rendering problems

Tommaso Tama
Greenhorn

Joined: Oct 13, 2010
Posts: 11
Hi,

I need a component that will do the following:

- render an icon with an HtmlAjaxCommandLink
- clicking the icon an action will be triggered
- clicking the icon a modal panel will appear with some label, text and so on.

This is the tag I have in mind:



So, I started to write a custom component that will extend an HtmlAjaxCommandLink




The idea is to use and then add a child component to the DOM:




Tag works fine ....


(see one.gif)

but if a JSF validation is triggered (i.e. a missing value in a mandatory field), something goes wrong.


(see two.gif)

The component is rendered again, so I have two icons in the page.


(see three.gif)

While debugging, I saw that after validation, encodeBegin is called again and that getChildCount() returns 1.
The solution I found is to invoke getChildren().clear() in encodeBegin method.

I know that this is not the right way to fix my problem.

Any suggestion?

Many thanks,
Tommaso



[Thumbnail for three.gif]

[Thumbnail for one.gif]

[Thumbnail for two.gif]

Tommaso Tama
Greenhorn

Joined: Oct 13, 2010
Posts: 11
Sorry, I forgot: I'm using JSF1.2 and Rich components (3.3).
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Custom component & validation/rendering problems
 
Similar Threads
Custom Component : Missing Update Model Phase?
IF strings are immutable why is the variable s appending and changing its obect
Custom UIInput
JSF Custom Component ,IBM Portal 7
Problems rendering custom component