Announcement Announcement Module
No announcement yet.
LoginCommand closeOnCancel Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • LoginCommand closeOnCancel

    I'm trying to make use of LoginCommand. I've specified it using following snippet:

    <bean id="loginCommand" class=""
    where lastUsername is instance of MethodInvokingFactoryBean which uses Preferences API to retrieve last username that was used to login.

    Problem I'm experiencing is in setting closeOnCancel. For some reason it is not being set to "true". I know it's default value is "true", but I prefer to see in context default values of bean properties. Do I have to register a custom binder (String <--> Boolean)? If yes, how?

    Thanks in advance for answers!

  • #2
    I've used the p namespace to set the closeOnCancel on the petclinic sample and had no problem with it. Setting a debug point in the setter method showed that it was called correctly.

    Strange that you have an issue with this, did you try to create a small sample that shows this problem?


    • #3
      Yes, problem is not in use of p namespace. For some yet unknown reason bean definition of loginCommand bean always has value "false" for closeOnCancel property. I've seen in samples this working, without any additional binders so its something project specific.

      After debugging, I've seen when xml bean definition files are loaded, commands-context.xml, in XmlBeanDefinitionReader a method registerBeanDefinitions is called, eventually parseBeanDefinitions method of DefaultBeanDefinitionReader gets called and in it loginCommand bean is read to have value "false" for closeOnCancel. (see attached screen capture)


      • #4
        There might be a problem in your context. If you've added several p: attributes, I would guess you should see them all in your screenshot under attributes. Have you tried extracting the problem to a smaller context (try only the login command and a simple screen)? Are there many imports of other contexts (try removing as many as possible)?


        • #5
          My bad, of course. Somehow, I just copied commands-context.xml file while I intenended to move it, and in application-context the reference remained the same. So every change made to copied file, didn't produce desired effect, as commands-context file copy wasn't being used at all. Original commands-context file was experiemental and had closeOnCancel property set to false which was applied as it should have. Silly me.