Announcement Announcement Module
No announcement yet.
Web form won't display at all Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Web form won't display at all

    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
    HTML Code:
                    var execute = function() {
                            type: "POST",
                            url: "assessments",
                            data: { choice: choice,
                                    consumer: consumer }
                    var cancel = function() {
                    var dialogOpts = {
                        buttons: {
                            "Ok" : execute,
                            "Cancel" : cancel
                        autoOpen : false,
                        height : "auto",
                        width : "auto",
                        modal : true
        @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")) {
            } else {
        @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";
    Logging - I have Spring trace on, so it's quite a lot:
    (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.

  • #2
    Hi There,
    You have written that you are using ajax request then how can you expect your form to get submitted
    The onoy thing that you can do is take response in ajax as text/html and punch it in your current web page / after successful ajax request submit the form explicitly by calling form.submit


    • #3
      What I didn't realize was that ajax only acts on the current form - you can't get anywhere other than the current form using ajax, if that makes sense. It took me this long to realize exactly what you were saying!

      I eventually constructed a GET request like this:
      var str = "assess?consumer=" + consumer + "&choice=" + choice;

      I executed the request, and it worked. (Now I have other issues to deal with! ;-( )

      Thank you for pointing me in the right direction.