4 Replies Latest reply on Aug 9, 2008 8:34 PM by guy bashan

    Resful problem

    guy bashan Apprentice

      Hi,


      I am trying to make a restful page.
      I added to pages.xml:


      <page view-id="/password.change.xhtml">
          <param name="confirmationCode" value="#{changePassword.confirmationCode}"/>
        </page>



      in my bean I added: confirmationCode member with setter and getter.


      I am getting this exception when trying to accesss the page:


      javax.el.ELException: Error writing 'confirmationCode' on type com.nikonians.ui.view.bean.ChangePasswordAction_$$_javassist_8
              at javax.el.BeanELResolver.setValue(BeanELResolver.java:112)
              at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
              at com.sun.faces.el.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:93)
              at org.jboss.el.parser.AstPropertySuffix.setValue(AstPropertySuffix.java:73)
              at org.jboss.el.parser.AstValue.setValue(AstValue.java:84)
              at org.jboss.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
              at org.jboss.seam.core.Expressions$1.setValue(Expressions.java:116)
              at org.jboss.seam.navigation.Pages.applyConvertedValidatedValuesToModel(Pages.java:796)
              at org.jboss.seam.navigation.Pages.postRestore(Pages.java:409)
              at org.jboss.seam.jsf.SeamPhaseListener.postRestorePage(SeamPhaseListener.java:544)
              at org.jboss.seam.jsf.SeamPhaseListener.afterRestoreView(SeamPhaseListener.java:390)
              at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:226)
              at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:192)
              at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
              at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
              at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
              at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: org.jboss.seam.RequiredException: @In attribute requires non-null value: changePassword.signupEvent
              at org.jboss.seam.Component.getValueToInject(Component.java:2178)
              at org.jboss.seam.Component.injectAttributes(Component.java:1601)
              at org.jboss.seam.Component.inject(Component.java:1419)
              at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:45)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
              at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
              at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
              at com.nikonians.ui.view.bean.ChangePasswordAction_$$_javassist_8.setConfirmationCode(ChangePasswordAction_$$_javassist_8.java)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)
      
      



      Am I doing something wrong?


      Thanks,
      Guy.

        • 1. Re: Resful problem
          Daniel Hinojosa Master

          Yep. ;)


          changePassword.signupEvent property is expecting something be placed in it.  If you don't need anything in that property when this bean is processed then by all means put a required=false in your @In annotation.

          • 2. Re: Resful problem
            guy bashan Apprentice

            Hi,


            I use the SignupEvent only for component binding with the confirmPassword control, in order to check the both password and confirm password are identical. I saw nothing in this class that may cause this problem and I am already using this class in a more complex screen (signup screen). This is a code of this class:


            @Name("signupEvent")
            @Scope(ScopeType.EVENT)
            public class SignupEvent
            {
              private HtmlInputSecret inputSecretPasswordConfirm;
            
              private HtmlSelectOneMenu htmlSelectOneMenuDay;
            
              private HtmlSelectOneMenu htmlSelectOneMenuMonth;
            
              private HtmlSelectOneMenu htmlSelectOneMenuYear;
            
              public HtmlInputSecret getInputSecretPasswordConfirm()
              {
                return inputSecretPasswordConfirm;
              }
            
              public void setInputSecretPasswordConfirm(HtmlInputSecret inputSecretPasswordConfirm)
              {
                this.inputSecretPasswordConfirm = inputSecretPasswordConfirm;
              }
            
              public HtmlSelectOneMenu getHtmlSelectOneMenuDay()
              {
                return htmlSelectOneMenuDay;
              }
            
              public void setHtmlSelectOneMenuDay(HtmlSelectOneMenu htmlSelectOneMenuDay)
              {
                this.htmlSelectOneMenuDay = htmlSelectOneMenuDay;
              }
            
              public HtmlSelectOneMenu getHtmlSelectOneMenuMonth()
              {
                return htmlSelectOneMenuMonth;
              }
            
              public void setHtmlSelectOneMenuMonth(HtmlSelectOneMenu htmlSelectOneMenuMonth)
              {
                this.htmlSelectOneMenuMonth = htmlSelectOneMenuMonth;
              }
            
              public HtmlSelectOneMenu getHtmlSelectOneMenuYear()
              {
                return htmlSelectOneMenuYear;
              }
            
              public void setHtmlSelectOneMenuYear(HtmlSelectOneMenu htmlSelectOneMenuYear)
              {
                this.htmlSelectOneMenuYear = htmlSelectOneMenuYear;
              }
            }




            Do you see anything that may cause this problem?


            Thanks,
            Guy.

            • 3. Re: Resful problem
              guy bashan Apprentice

              Anyway, I don't think the problem is in the signupEvent since when I remove the line:


              <param name="confirmationCode" value="#{changePassword.confirmationCode}"/>



              everything is working good.


              And this is not the first time that I see exception in Seam that says something but the actual real problem is somewhere down along the stacktrace...

              • 4. Re: Resful problem
                guy bashan Apprentice

                ok, I solved the problem. It seems like when adding the param line in pages.xml Seam actually instantiate the changePassword bean and checks for @In value to exist even before rendering the page itself. This causes the @In to throw exception of required value, even though the page is rendered in the next millisecond and contains a call to signupEvent.


                Anyway, now I am having a different question:
                The page now is loaded properly, but after pressing the submit value, if validation does not pass, the confirmationCode parameter disappears from the request url (of the browser). Is it a proper behavior? This is exactly how JSF works...