I am writing a basic login screen with textboxes for username and password, a submit button and a commandLink to redirect to a page to retrieve password. I have set required = true for both text fields and set a required message too. Now, if i need to redirect to the retrieve password page without entering any text in the textboxes, it wont let me. Kindly help.
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<ui:composition template="/template/Template.xhtml">
<ui:define name="title">Login</ui:define>
<ui:define name="pageContent">
<h:form>
<p:messages id="message1" closable="true"/>
<p:panelGrid id="loginPanel" columns="2"
style="margin-left: auto;margin-right: auto;margin-top: 10%;border-style:none">
<h:outputLabel for="uName" value="User Name "></h:outputLabel>
<p:inputText id="uName" value="#{loginBean.uName}" required="true"
requiredMessage="#{prop.userNameRequired}"></p:inputText>
<h:outputLabel for="passwrd" value="Password "></h:outputLabel>
<p:password id="passwrd" value="#{loginBean.passwrd}"
required="true" requiredMessage="#{prop.passwordRequired}"></p:password>
</p:panelGrid>
<p:commandButton id="login" value="Login"
style="margin-left: 40%;margin-top: 2%"
action="#{loginBean.authenticate}" ajax="false"></p:commandButton>
<p:spacer></p:spacer>
<p:commandLink id="forgotPass" value="Forgot User-Name/Password ?"
style="margin-left: 4.5%;font-size:0.7em" action="ForgotPassword.xhtml?faces-redirect=true"></p:commandLink>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>