Found the issue w/ my second problem w/ the Session Attribute being initialized. I was simplifying my code when I created the post -- I'm sorry -- I now realize I simplified it too much to make diagnosing this reasonable.
The code that is in two files in the same project.
Code:
package com.generic.orderentry.skuselection.requesthandler;
@Controller
@RequestMapping("VIEW")
@SessionAttributes(value={"commonBean"})
public class HomeScreenRequestHandler {
/* All Event Handlers And Action Handlers and Renderers. */
@EventMapping(value = "ReturnToHome")
public void returnToHome(Model model,
@ModelAttribute("commonBean") selectionBean commonBean,
EventRequest request, EventResponse response)
{
logger.debug("Value in EventHandler: " + commonBean.getSavedValue);
/* Same behavior w/ or w/o the addAttribute of the commonBean line: */
model.addAttribute("commonBean", commonBean);
model.addAttribute("TestCase", "value1");
response.setRenderParameter("nextScreen", "selectStyles");
}
and
Code:
package com.generic.orderentry.skuselection.requesthandler;
@Controller
@RequestMapping("VIEW")
public class SelectStyleScreenRequestHandler {
/* All resource request handlers */
@RenderMapping(params = "nextScreen=selectStyles")
public String showSelectStyles(Model model, @ModelAttribute("commonBean") selectionBean commonBean){
/* common bean is fine in here. */
}
@ResourceMapping(value="showStyleDetails")
public String showStyleDetails(Model model,
@ModelAttribute("commonBean") selectionBean commonBean) {
/* In here if last request was action or other resource request,
commonBean is initialized to the value at the beginning of
session. */
/* However, if the last request was an event, then, the commmonBean
is reinstantiated, rather than taking it from the Session. */
. . .
return("selectStyles.jsp");
}
With the configuration:
Code:
<beans . . . >
. . . .
<context:component-scan base-package="com.generic.orderentry.skuselection.requesthandler" />
</beans>
This was for code organization, since one large class was getting unwieldy. During initial testing w/ just resource and action requests, everything worked as expected. Only when the event handling got tested, did the exact same showSelectStyles() get a newly instantiated commonBean rather than the one previously added to the session. What's confusing is that it wasn't on the event request, but on the subsequent resource request after the event request had been handled that the problem appeared. The same resource request received the correct value of commonBean when it was just action & resource requests.
The resolution was to add
Code:
@SessionAttributes(value={"commonBean"})
to the 2nd file. Then, it worked.
I don't get this. I'm inclined to think this is a bug, but a pretty obscure one. I'll see what I can come up with to boil this down into the smallest example possible and file a bug report.
Thanks for the help.