I want to have a validator for my password reset. It will look at the URL and parse the token_id out of it. I have the rest of the logic done. I need this validator to be called on page load from my jsf view. However I cannot find a way to invoke the validator using a preRender function. The code below is to call the userBean and check the token. How would I change this to call a validator rather than a managed bean property?
<f:metadata>
<f:event listener="#{userBean.check()}" type="preRenderView"/>
</f:metadata>
resetPassword.xhtml
<h:body>
<!-- Preload to assure the token is correct -->
<ui:composition template="/WEB-INF/templates/base.xhtml">
<ui:define name="title">Recover your username</ui:define>
<ui:define name="metadata">
<f:metadata>
<f:viewParam name="tok_id" value="#{userBean.token}" validator="resetValidator" />
</f:metadata>
</ui:define>
<ui:define name="content">
You should receive a email shortly with your new password in it.
</ui:define>
</ui:composition>
</h:body>
Is there any chance it has to do with me using templates?
base.xhtml
<h:body>
<div id="wrapper">
<f:view>
<ui:insert name="metadata"/>
<!-- Header Begin -->
<ui:insert name="header">
<ui:include src="/WEB-INF/templates/header.xhtml" />
</ui:insert>
<!-- Header End -->
<div id="mainBox">
<div id="main">
<!-- Content Begin -->
<ui:insert name="content" >
<ui:include src="/WEB-INF/templates/content.xhtml" />
</ui:insert>
<!-- Content End -->
</div>
</div>
<div style="clear: both"></div>
<!-- Footer Begin -->
<ui:insert name="footer">
<ui:include src="/WEB-INF/templates/footer.xhtml" />
</ui:insert>
<!-- Footer End -->
</f:view>
</div>
<h:outputScript library="js" name="base.js" />
</h:body>
content.xhtml
<h:body>
<ui:composition></ui:composition>
</h:body>