html - Java EE tutorial, cannot access "userBirthday" input Date -


when doing firstcup-war tutorial java ee http://docs.oracle.com/javaee/7/firstcup/doc/web-application005.htm error message not shown because cannot select right html element. have following code:

    <fc:inputdate id="userbirthday" date="#{dukesbday.yourbd}" />       <h:outputtext value=" #{bundle.pattern}"/>       <p/>       <h:commandbutton value="#{bundle.submit}" action="#{dukesbday.processbirthday}"/>       <p/>       <h:message for="userbirthday" style="color:red"/> 

when looking @ source code in browser see name tag "j_idt6:userbirthday:j_idt16". if change last line of above posted code to:

        <h:message for="j_idt6:userbirthday:j_idt16" style="color:red"/> 

it works again. why java ee append j_idt6 , j_idt16 @ beginning , end of name tag. , why code in tutorial not working. can make work, without having check source code, actual tag name looks like.

the final id inputdate generated in following format: formid:componentid:internalcomponentid

your form has no id, unique id generated.
inputdate component has id "userbirthday".
internal inputtext has no id, unique id generated.

but can avoid defining ids each component.

inputdate.xhtml:
<h:inputtext id="inputdateid" value="#{cc.attrs.date}">

greeting.xhtml:
<h:form id="greetingformid"> ... <fc:inputdate id="userbirthdayid" date="#{dukesbday.yourbd}" /> ... <h:message for="greetingformid:userbirthdayid:inputdateid" style="color:red"/>

then error message following:

greetingformid:userbirthdayid:inputdateid: '23.12.2001' konnte nicht als datum interpretiert werden. beispiel: 05/06/2014


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -