Announcement Announcement Module
Collapse
No announcement yet.
@SessionAttributes doesn't get removed in Spring Portlet MVC Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @SessionAttributes doesn't get removed in Spring Portlet MVC

    I have a simple Portlet that I expect to take some user input, do some stuff and show a success message. The code goes like this:

    Code:
    @Controller(value = "myController")
    @RequestMapping(value = "VIEW")
    @SessionAttributes("myCommand")
    public class MyController {
    
        @ModelAttribute("someList")
        public Map<String, String> getSomeList() {
            return theList;
        }
    
        @ModelAttribute("myCommand")
        public CambioPlanCommand getCommandObject(PortletSession session,
                Principal principal) throws SeguridadMiClaroException {
            MyCommand command = new MyCommand();
            return command;
        }
    
        @RenderMapping
        public String showView() {
            return "myView";
        }
    
        @ActionMapping(params = "action=stuff")
        public void doStuff(
                @ModelAttribute(value = "myCommand") MyCommand datosFormulario,
                BindingResult bindingResult, SessionStatus status,
                PortletSession session, Principal principal, ModelMap modelMap,
                PortletRequest request) {
    
                modelMap.put("theMessage", "Stuff is done");
                status.setComplete();
    
    
        }
    
    }
    The first time I execute the Portlet everything goes fine: The command object gets populated, the message is put in model and my JSP shows it in screen. Then I go to another page to play with some other portlets; and when I return to my original Portlet I expect the following:

    - To get an empty instance of MyCommand
    - To see no Message in Screen

    But I find the opossite, and I still see the message configured in the previous request. I'm very confused about this, since the Message was not configured as a SessionAttribute (only the command) and I called SessionStatus.setComplete() so if everything was stored in Session it should already be removed.

    Any ideas?
    Last edited by cptan_alatriste; Oct 29th, 2012, 10:41 AM. Reason: Format improvement

  • #2
    Seems realted to this Jira Issue and this Thread. Any news if this get fixed?

    Comment

    Working...
    X