- This topic has 2 replies, 3 voices, and was last updated 15 years, 8 months ago by ernestz.
-
AuthorPosts
-
venkatMemberThis is really frustrating.I mean I wasted my whole sunday finding out why the ” inputSecret ” is not passing the value to the backing bean.It is always passing null to the backing bean.long story short,on a login screen , when you pass username and password nothings happens when you click the submit button…
I am using myeclipse 7.1.1 and icefaces 1.7.2….I have tried in so many scenarios but nothing worked for me.is this a bug in myeclipse or icefaces? …..any help would be really appreciated.
MyEclipse: 7.1.1
icefaces :1.7.2I posted this in the icefaces forum,but was not of a much help.here is the link for the post in icefaces forum
http://www.icefaces.org/JForum/posts/list/12134.page
Here is the original code:
<?xml version="1.0" encoding="ISO-8859-1" ?> <jsp:root version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:ice="http://www.icesoft.com/icefaces/component" xmlns:x="http://java.sun.com/jsp/jstl/xml"> <jsp:directive.page contentType="text/html;charset=ISO-8859-1" pageEncoding="ISO-8859-1" /> <f:view> <ice:outputDeclaration doctypeRoot="html" doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN" doctypeSystem="http://www.w3.org/TR/html4/loose.dtd" /> <html> <head> <title>Home Page</title> <link rel="stylesheet" type="text/css" href="./xmlhttp/css/xp/xp.css" /> </head> <body> <!--<f:loadBundle basename="com.attila.util.MessageBundle" var="bundle" />--> <ice:outputText value="Thank you for using Attila." /> <ice:form id="loginForm" partialSubmit="true"> <ice:panelGrid border="1" columns="2"> <ice:outputLabel for="userName"> <ice:outputText value="User Name" /> </ice:outputLabel> <ice:inputText action="#{UserBean.loginUser}" value="#{UserBean.userName}" id="userName"> <!--<f:validator validatorId="com.attila.web.jsf.validator.UserName" />--> </ice:inputText> <!--<ice:message for="userName"/>--> <ice:outputLabel for="password"> <ice:outputText value="Password" /> </ice:outputLabel> <ice:inputSecret action="#{UserBean.loginUser}" id="password"></ice:inputSecret> <!--<ice:message for="password" />--> <ice:panelGroup> </ice:panelGroup> <ice:commandButton value="Login" action="#{UserBean.loginUser}" id="submit" /> </ice:panelGrid> <ice:messages /> </ice:form> </body> </html> </f:view> </jsp:root>
backing bean :i am pasting here only the action method public String loginUser() { FacesContext facesContext = FacesContext.getCurrentInstance(); if("myeclipse".equals(getUserName()) && "myeclipse".equals(getPassword())) { return"success"; } FacesMessage facesMessage = new FacesMessage( "You have entered an invalid user name and/or password"); facesContext.addMessage("loginForm", facesMessage); return "failure"; }
Then people suggested so many ways but nothing worked for me.one of the solution was to add the actionListner to inputSecret,but didn’t work either.Here is one of the suggestion I have tried with
<?xml version="1.0" encoding="ISO-8859-1" ?> <jsp:root version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:ice="http://www.icesoft.com/icefaces/component" xmlns:x="http://java.sun.com/jsp/jstl/xml"> <jsp:directive.page contentType="text/html;charset=ISO-8859-1" pageEncoding="ISO-8859-1" /> <f:view> <ice:outputDeclaration doctypeRoot="html" doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN" doctypeSystem="http://www.w3.org/TR/html4/loose.dtd" /> <html> <head> <title>Home Page</title> <link rel="stylesheet" type="text/css" href="./xmlhttp/css/xp/xp.css" /> </head> <body> <!--<f:loadBundle basename="com.attila.util.MessageBundle" var="bundle" />--> <ice:outputText value="Thank you for using Attila." /> <ice:form id="loginForm" partialSubmit="true"> <ice:panelGrid border="1" columns="2"> <ice:outputLabel for="userName"> <ice:outputText value="User Name" /> </ice:outputLabel> <ice:inputText action="#{UserBean.loginUser}" value="#{UserBean.userName}" id="userName"> <!--<f:validator validatorId="com.attila.web.jsf.validator.UserName" />--> </ice:inputText> <!--<ice:message for="userName"/>--> <ice:outputLabel for="password"> <ice:outputText value="Password" /> </ice:outputLabel> <ice:inputSecret action="#{UserBean.loginUser}" id="password"></ice:inputSecret> <!--<ice:message for="password" />--> <ice:panelGroup> </ice:panelGroup> <ice:commandButton value="Login" action="#{UserBean.loginUser}" id="submit" /> </ice:panelGrid> <ice:messages /> </ice:form> </body> </html> </f:view> </jsp:root>
backing bean :i am pasting here only the action method public String loginUser() { FacesContext facesContext = FacesContext.getCurrentInstance(); if("myeclipse".equals(getUserName()) && "myeclipse".equals(getPassword())) { return"success"; } FacesMessage facesMessage = new FacesMessage( "You have entered an invalid user name and/or password"); facesContext.addMessage("loginForm", facesMessage); return "failure"; }
Please help me !!!!!!!!!
Loyal WaterMemberHi,
I just got a reply from the dev team and this seems like an ICEfaces issue. You will have to check with them on their forums.
ernestzMemberIt looks like you are missing a ‘value’ attribute on your inputSecret tag (password), so the JSF Framework has nothing to ‘set’.
-
AuthorPosts