Here's my situation. I have a jsp page that displays some data. If the user clicks on a table, a dialog pops up and asks them which assessment they want to display. They choose an assessment, click "Ok", and the view should
change to the assessment page, and it won't. Some facts about my pages: there are NO forms; I do everything through jQuery via the $.ajax command. (That part is working.) And I'm using Spring Security. My versions of everything are Java 1.7, Spring 3.0.6 (MVC), and Spring Security 3.0.6.
Here are the relevant bits of my code:
dashboard.jsp - just the jquery
DashboardController.java:HTML Code:var execute = function() { $("#choose-one").dialog("close"); $.ajax({ type: "POST", url: "assessments", data: { choice: choice, consumer: consumer } }); }; var cancel = function() { $("#choose-one").dialog("close"); }; var dialogOpts = { buttons: { "Ok" : execute, "Cancel" : cancel }, autoOpen : false, height : "auto", width : "auto", modal : true }; $('#choose-one').dialog(dialogOpts);
AssessmentsController.java:Code:@RequestMapping(value = "/assessments", method = RequestMethod.POST) public String assessments(HttpServletRequest req, Model model) { String consumer = req.getParameter("consumer"); String[] str = consumer.split(","); model.addAttribute("firstName", str[1].toUpperCase()); model.addAttribute("lastName", str[2].toUpperCase()); model.addAttribute("IDConsumer", str[3]); String choice = req.getParameter("choice"); if (choice.contains("Consumer")) { return "redirect:/assessments/CRM"; } else if (choice.contains("Inventory")) { blah } else { blah } }
Logging - I have Spring trace on, so it's quite a lot:Code:@RequestMapping(value = "/assessments/CRM", method = RequestMethod.GET) public String assessCRM(HttpServletRequest req, Model model) { System.out.println("got to AssessmentsController GET"); model.addAttribute("CRM", new CRM()); return "assessments/CRM"; }
(It gave me an error while posting - I'll have to do an attachment.)
I'm sorry about the length of this post, but I thought it was better if you had all the information. I suspect it's somewhere in the way I'm using redirect:, but I'm not sure. I'm perplexed.


Reply With Quote
