-
1. Re: trouble using password verify as in booking example
hstang Jan 30, 2007 8:51 PM (in response to henrik.lindberg)You need to some code
-
2. Re: trouble using password verify as in booking example
henrik.lindberg Jan 30, 2007 9:00 PM (in response to henrik.lindberg)Sorry, I need to what? Do you mean post some code?
Here is the register action (sans imports)
@Stateful
@Scope(EVENT)
@Name("register")
public class RegisterAction implements Register
{
@In @Out
private User user;
@PersistenceContext
private EntityManager em;
@Logger
private Log log;
private String m_verify;
public String register()
{
if(!user.getPassword().equals(m_verify))
{
FacesMessages.instance().add("Password mismatch - please try again");
this.m_verify = null;
return null;
}
if(!User.exists(em, user.getLogin()))
{
em.persist(user);
log.info("Registered new user #{user.login}");
return "/registered.seam";
}
FacesMessages.instance().add("User #{user.login} already exists! Choose a different login.");
return null;
}
public String getVerify()
{
return m_verify;
}
public void setVerify(String verify)
{
this.m_verify = verify;
}
@Destroy
@Remove
public void destroy()
{
}
} -
3. Re: trouble using password verify as in booking example
henrik.lindberg Jan 30, 2007 9:12 PM (in response to henrik.lindberg)And here is the register.xhtml (Sorry for all the {} instead of normal lt/gt 'XML brackets' - the forum software choked on this otherwise - I hope you can read it - it is truly boiler-plate code (I chopped off the standard stuff at the beginning of the file.
{ui:define name="body"}
{f:view}
{h:form}{fieldset}
{table border="0" class="formTable"}
{col class="labelCol"/}
{col class="inputCol"/}
{s:validateAll}
{tr}
{td}{h:outputLabel for="login"}Username (login):{/h:outputLabel}{/td}
{td}{h:inputText id="login" value="#{user.login}" required="true"/}{/td}
{/tr}
{tr}
{td}{h:outputLabel for="realName"}Real Name:{/h:outputLabel}{/td}
{td}{h:inputText id="realName" value="#{user.realName}" required="true"/}{/td}
{/tr}
{tr}
{td}{h:outputLabel for="password"}Password:{/h:outputLabel}{/td}
{td}{h:inputSecret id="password" value="#{user.password}" required="true"/}{/td}
{/tr}
{tr}
{td}{h:outputLabel for="verify"}Verify Password:{/h:outputLabel}{/td}
{td}{h:inputSecret id="verify" value="#{register.verify}" required="true"/}{/td}
{/tr}
{tr}
{td}{h:outputLabel for="email"}Email:{/h:outputLabel}{/td}
{td}{h:inputText id="email" value="#{user.email}" required="true"/}{/td}
{/tr}
{/s:validateAll}
{/table}
{h:messages/}
{h:commandButton type="submit" value="Register" action="#{register.register}"/}
{/fieldset}
{/h:form}
{/f:view}
{/ui:define} -
4. Re: trouble using password verify as in booking example
henrik.lindberg Jan 30, 2007 9:15 PM (in response to henrik.lindberg)If I remove the inputSecret that refers to register.verify I do not get the error, but naturally, register then sees that the password and verify are not equal. Commenting out the test that they are equal works fine.
So, can anyone tell me what I am doing wrong? -
5. Re: trouble using password verify as in booking example
henrik.lindberg Jan 30, 2007 9:19 PM (in response to henrik.lindberg)I am running seam 1.1GA, and JBoss 4.0.5GA. The rest of my application is pretty much bolierplate as gnerated by seam gen.
Could the LoggedInInterceptor have anything to do with this problem? I added that to my project - a copy from one of the examples, and it works fine where I used it (not used in the code that is giving me trouble). -
6. Re: trouble using password verify as in booking example
hstang Jan 31, 2007 12:38 AM (in response to henrik.lindberg)"henrik.lindberg" wrote:
Hi,
a message saying "value could not be converted to the expected type".
Where is this message coming from? The console? The UI? If there's nothing coming out from the console, double check to see server.log (if you are using JBoss to really make sure nothing is there) -
7. Re: trouble using password verify as in booking example
henrik.lindberg Jan 31, 2007 2:56 AM (in response to henrik.lindberg)I looked at both the server log and the console output - I can not find anything there that gives me a clue - no exceptions, warnings, etc.
The message appears where I have the <h:messages/> tag.
Guessing that something has caught an exception and is "helping" by providing this message without logging the original problem. -
8. Re: trouble using password verify as in booking example
henrik.lindberg Feb 1, 2007 4:18 AM (in response to henrik.lindberg)I am still having trouble. Have tried several things...
Maybe a constructor that set m_verify to an empty string would help? Tried it - no change.
Maybe I need a @Create method. Tried it, no difference.
Removed the EVENT scope for the RegisterAction. Same problem.
Also noticed that it does not matter what I type. When validating the form I always get the same error.
Hints anyone? -
9. Re: trouble using password verify as in booking example
gavin.king Feb 1, 2007 4:23 AM (in response to henrik.lindberg)That message is coming from JSF. I'm not sure the exact cause. What does your local interface look like? Does it have the get/set methods declared?
-
10. Re: trouble using password verify as in booking example
henrik.lindberg Feb 1, 2007 4:36 AM (in response to henrik.lindberg)Changed the secret output to a normal field, and set some text in m_verify in the constructor. And now I got something different - an exception that tells me that it can not find the property...
javax.faces.el.PropertyNotFoundException: /register.xhtml @34,88 value="#{register.verify}": Bean: org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$771e27f9, property: verify
at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58)
at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:217)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:135)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:53)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:580)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:619) -
11. Re: trouble using password verify as in booking example
gavin.king Feb 1, 2007 4:40 AM (in response to henrik.lindberg)Is getVerify()/setVerify() on the local interface?
-
12. Re: trouble using password verify as in booking example
henrik.lindberg Feb 1, 2007 5:14 AM (in response to henrik.lindberg)Local interface did not have getVerify() nor setVerify() declared - and... the example Local interface has these.
My mistake.
Thanks Gavin !!!
Getting a better error message would have helped a newbie a lot - the initial "can not convert..." that I got was quite confusing.
But hey! problem solved. Thanks again.
Cheers
- henrik -
13. Re: trouble using password verify as in booking example
gavin.king Feb 1, 2007 5:18 AM (in response to henrik.lindberg)Its not my message, its from JSF. I don't actually approve of how JSF handles these cases.
-
14. Re: trouble using password verify as in booking example
henrik.lindberg Feb 1, 2007 8:55 AM (in response to henrik.lindberg)Thanks Gavin,
I totally understand. No problem.