Wednesday, April 18, 2007

Interesting observation about JSF

i came across an interesting fact
due to my usual habit of copy_cut_paste
but will find about the reason for it later ... when i have more time in hand

If I have the following code on a page ... ( neglect the wrong syntax .. lib name excluded )
** NOTE ** that the id of both the <:selectOneMenu>
so how does JSF handles it ...

<:outputText value="SOME_OPTION" />
<:selectOneMenu id="id_one" >
<:selectItem itemValue="option_1" itemLabel="option_1"/>
<:selectItem itemValue="option_2" itemLabel="option_2"/>
<:selectItem itemValue="option_3" itemLabel="option_3"/>

<:outputText value="ANOTHER_OPTION" />
<:selectOneMenu id="id_one" >
<:selectItem itemValue="another_option_1" itemLabel="another_option_1"/>
<:selectItem itemValue="another_option_2" itemLabel="another_option_2"/>
<:selectItem itemValue="another_option_3" itemLabel="another_option_3"/>

well ..
It doesnt give a Compile time error
NOR does it give a Runtime error
... instead ...
when the page is displayed then the second option is silently removed

wonder why ??

No comments: