title: display the post data in the angular js jsp page
body: <p>i have a form designed with angular js, upon submit it post the data to the spring controller, which intern processes the data to be displayed in the new jsp page.</p>
  
  <p>part 1: form submit through angular js to the spring controller (Completed)</p>
  
  <p>part 2: Spring controller to process the post data and return the json string object (completed)</p>
  
  <p>part 3: The data received in the success part of the spring controller and displaying the data in the new jsp page (yet to completed, need help).</p>
  
  <p>Problem here is that i can post the json data , but could not able to display the json date in the jsp page (AuditDisplayResultPage.jsp), basically i cannot accomplish the part3.</p>
  
  <hr>
  
  <h2>part 1 source code</h2>
  
  <p><strong>AuditDisplayPage.jsp</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt;
  &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
  
  &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;meta charset="utf-8"&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"&gt;&lt;/script&gt;
  &lt;script src="/LDODashBoard/js/scripts.js" language="JavaScript" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="/LDODashBoard/js/AuditDisplayPage.js" language="JavaScript" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/angular-filter/0.5.8/angular-filter.min.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="/LDODashBoard/css/mystyle.css" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="/LDODashBoard/css/AuditDisplayPage.css" /&gt;
  
  
  
  &lt;body&gt;
  
  
      &lt;div ng-app="myApp" ng-controller="myCtrl" style="color:white" div align="left"&gt;
  
          &lt;br/&gt;&lt;br/&gt;  
          &lt;form name = "audit" novalidate&gt;
  
              &lt;label for="marketArraySel" &gt;Market:&lt;/label&gt;
              &lt;select id="marketArraySel" ng-model="marketArraySel" ng-options="market as getMarketFullName(market) for market in marketArray | orderBy:'name' track by market.id" ng-change="updateChanges()" ng-selected="selectedExpression()"&gt;
              &lt;option value=""&gt;[NO SELECTION]&lt;/option&gt;
              &lt;/select&gt;
  
              &amp;nbsp;
              &lt;label for="accountText" &gt;Account:&lt;/label&gt;
              &lt;input type="text" id="accountText" ng-model="accountName" ng-change="onAccountTextChange()"&gt;&lt;/input&gt;   
  
              &lt;br/&gt;
              &lt;label for="marketNameType" &gt;Type the Market:&lt;/label&gt;
              &lt;input type="text" id="marketNameType" ng-model="marketNameType" ng-change="selectmarketByName(marketNameType)" /&gt;                      
  
              &lt;br/&gt;&lt;br/&gt;
  
              &lt;label for="textareavalue" ng-show="marketArraySel.id &amp;&amp; accountName"&gt;Selected Details:&lt;/label&gt;
              &lt;textarea id="textareavalue" ng-model="textareavalue" style="color:blue" disabled ng-show="marketArraySel.id &amp;&amp; accountName"&gt;{{textareavalue}}&lt;/textarea&gt;
              &lt;br /&gt;
              &lt;!-- 
              &lt;span size=10&gt;&lt;STRONG&gt; Selected Market: {{marketArraySel.name}} &lt;/STRONG&gt; &lt;/span&gt;
  
              &lt;span id="tab"&gt;&lt;/span&gt;
              &lt;span id="tab"&gt;&lt;/span&gt;
              &lt;span id="tab"&gt;&lt;/span&gt;
              &lt;span id="tab"&gt;&lt;STRONG&gt; Selected Account: {{accountName}} &lt;/STRONG&gt;&lt;/span&gt;
  
              --&gt;
  
              &lt;br/&gt; &lt;br/&gt;
  
              &lt;input type="reset" ng-click="reset()" value="RESET"&gt;&lt;/input&gt;
              &amp;nbsp;
              &amp;nbsp;
              &lt;input type="button" ng-click="submitfunction()" value="SUBMIT" ng-disabled="!marketArraySel.id &amp;&amp; !accountName"&gt;&lt;/input&gt;
          &lt;/form&gt;
  
      &lt;br&gt;&lt;br&gt;
  
      &lt;span id="tab"&gt;&lt;/span&gt;&lt;span id="tab"&gt;&lt;/span&gt;&lt;span id="tab"&gt;&lt;/span&gt;&lt;span id="tab"&gt;&lt;/span&gt;&lt;span id="tab"&gt;&lt;/span&gt;&lt;span id="tab"&gt;&lt;/span&gt;&lt;span id="tab"&gt;&lt;/span&gt;&lt;span id="tab"&gt;&lt;/span&gt;
      &lt;c:url value="/L1OutputDisplayPage?gcmmLink2=true" var="messageUrl2" /&gt;
      Click &lt;a href="${messageUrl2}" style="color:yellow" onclick="doSomething('displayContent','/LDODashBoard/L1OutputDisplayPage?','gcmmLink2=true');return false;"&gt; Here&lt;/a&gt;
       to Close
  
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>AuditDisplayPage.js</p>
  
  <pre><code> $scope.submitfunction = function() {
  
          var dataObj = {
                  name : getById($scope.marketArray,$scope.marketArraySel.id),
                  account : $scope.accountName,
                  database : getDatabaseById($scope.marketArray,$scope.marketArraySel.id)
          };
  
  
          $http({
              'url' : '/LDODashBoard/AuditDisplayPost',
              'method' : 'POST',
              'headers': {'Content-Type' : 'application/json'},
              'data' : dataObj
          })     
          .success(function(data, status, headers,config,ele) {
  
                                     window.alert('Success4');
                                     $scope.message = data;
  
                                     //covert the json object to string 
                                     //var message1 = JSON.stringify($scope.message);
  
                                     window.alert('message1:' + message1);
  
                                     //window.location("/LDODashBoard/AuditDisplayPostResponse?argument1=" + "hello");
                                     window.location("/LDODashBoard/AuditDisplayPostResponse?argument1=" + message);
  
  
  /*                                   
  
   Message value 
                                     {"cvAuditClassList":[{"db_seq":13084,"operator":"cricha19","action":"I","cv_table":12,"id":3006538,"comments":"Acc:YP2MD;Firm:L;Off:;Sungard:;"},{"db_seq":31244,"operator":"cricha19","action":"I","cv_table":12,"id":3014027,"comments":"Acc:YP2MD;Firm:L;Off:;Sungard:;"},{"db_seq":40739,"operator":"gdennis2","action":"U","cv_table":5,"id":3014027,"comments":"Clair:AAKASH AGARWAL;"},{"db_seq":56740,"operator":"mzak1","action":"I","cv_table":12,"id":3043260,"comments":"Acc:YP3CW;Firm:L;Off:;Sungard:;"},{"db_seq":56748,"operator":"mzak1","action":"I","cv_table":12,"id":3043264,"comments":"Acc:YP3CW;Firm:L;Off:;Sungard:;"},{"db_seq":52647,"operator":"bkamins11","action":"I","cv_table":12,"id":3041524,"comments":"Acc:YP3CW;Firm:L;Off:;Sungard:;"},{"db_seq":76771,"operator":"rmarczak","action":"I","cv_table":12,"id":3053777,"comments":"Acc:YP3CW;Firm:L;Off:;Sungard:;"},{"db_seq":76772,"operator":"rmarczak","action":"I","cv_table":13,"id":3053777,"comments":"Idcp1:CREDIT SUISSE;Idcp2:;Idcp3:;"},{"db_seq":74719,"operator":"iteppel","action":"I","cv_table":13,"id":3043264,"comments":"Idcp1:CREDIT SUISSE;Idcp2:;Idcp3:;"},{"db_seq":74749,"operator":"iteppel","action":"I","cv_table":13,"id":3043260,"comments":"Idcp1:CREDIT SUISSE;Idcp2:;Idcp3:;"},{"db_seq":79437,"operator":"aimierow","action":"I","cv_table":12,"id":3054314,"comments":"Acc:YP2MD;Firm:L;Off:;Sungard:;"},{"db_seq":79438,"operator":"aimierow","action":"I","cv_table":13,"id":3054314,"comments":"Idcp1:CREDIT SUISSE;Idcp2:;Idcp3:;"},{"db_seq":113297,"operator":"iteppel","action":"I","cv_table":12,"id":3106380,"comments":"Acc:B825M;Firm:L;Off:;Sungard:;"},{"db_seq":113298,"operator":"iteppel","action":"I","cv_table":13,"id":3106380,"comments":"Idcp1:CREDIT SUISSE;Idcp2:;Idcp3:;"},{"db_seq":113299,"operator":"iteppel","action":"U","cv_table":5,"id":3106380,"comments":"Clair:cs;"},{"db_seq":113300,"operator":"iteppel","action":"I","cv_table":9,"id":3006538,"comments":"Name:%GI-YP2MD%;Broker:%;Ctr:%;CbType:0;AccOptFut:47;CtrType:;"},{"db_seq":113301,"operator":"iteppel","action":"D","cv_table":9,"id":3006538},{"db_seq":113302,"operator":"iteppel","action":"I","cv_table":9,"id":3006538,"comments":"Name:%GI-YP2MD%;Broker:CSBLO;Ctr:%;CbType:0;AccOptFut:47;CtrType:;"},{"db_seq":113303,"operator":"iteppel","action":"D","cv_table":9,"id":3006538},{"db_seq":113304,"operator":"iteppel","action":"I","cv_table":9,"id":3006538,"comments":"Name:%GI-YP2MD%;Broker:CSILO;Ctr:%;CbType:0;AccOptFut:47;CtrType:;"},{"db_seq":109823,"operator":"mskiba","action":"I","cv_table":12,"id":3082104,"comments":"Acc:YP2MD;Firm:L;Off:;Sungard:;"},{"db_seq":109824,"operator":"mskiba","action":"I","cv_table":13,"id":3082104,"comments":"Idcp1:CREDIT SUISSE;Idcp2:;Idcp3:;"},{"db_seq":125379,"operator":"mpeitsc1","action":"I","cv_table":12,"id":3118253,"comments":"Acc:YP2MD;Firm:L;Off:;Sungard:;"},{"db_seq":125380,"operator":"mpeitsc1","action":"I","cv_table":13,"id":3118253,"comments":"Idcp1:CREDIT SUISSE;Idcp2:;Idcp3:;"},{"db_seq":125382,"operator":"mpeitsc1","action":"I","cv_table":12,"id":3118254,"comments":"Acc:YP2MD;Firm:L;Off:;Sungard:;"},{"db_seq":125383,"operator":"mpeitsc1","action":"I","cv_table":13,"id":3118254,"comments":"Idcp1:CREDIT SUISSE;Idcp2:;Idcp3:;"},{"db_seq":125385,"operator":"mpeitsc1","action":"I","cv_table":12,"id":3118255,"comments":"Acc:YP2MD;Firm:L;Off:;Sungard:;"},{"db_seq":125386,"operator":"mpeitsc1","action":"I","cv_table":13,"id":3118255,"comments":"Idcp1:CREDIT SUISSE;Idcp2:;Idcp3:;"},{"db_seq":125388,"operator":"mpeitsc1","action":"I","cv_table":12,"id":3118256,"comments":"Acc:YP2MD;Firm:L;Off:;Sungard:;"},{"db_seq":125389,"operator":"mpeitsc1","action":"I","cv_table":13,"id":3118256,"comments":"Idcp1:CREDIT SUISSE;Idcp2:;Idcp3:;"}]}
  */
                                  })
          .error(function(data, status, headers, config) {
                                      window.alert('Error2');
                                      $scope.message1 =  data;
           });
  
          window.alert("alert4");
      };
  </code></pre>
  
  <hr>
  
  <h2>part 2 source code</h2>
  
  <p><strong>DatabaseController.java</strong></p>
  
  <pre><code>@RequestMapping(value = "/AuditDisplayPost", method = RequestMethod.POST,  consumes = MediaType.APPLICATION_JSON_VALUE)
      public @ResponseBody String auditDisplayPost(
      @RequestBody  AuditDisplayPostClass postClass, UriComponentsBuilder ucb) {
  
  
  
  
          QueryExecutionResults execResults = null;
  
          log.info("inisde AuditDisplayPost method");
          log.info("auditdisplaypostclass name:" + postClass.getName());
          log.info("auditdisplaypostclass account:" + postClass.getAccount());
          log.info("auditdisplaypostclass database:" + postClass.getDatabase());
  
          CVAuditDisplayResponse auditResponse =  new CVAuditDisplayResponse();
  
          CVAuditStaticUserParams cvstaticparams =  new CVAuditStaticUserParams();
          cvstaticparams.setNames(DBCheckoutBean.retrieveStringTokenQuery(postClass.getAccount()," "));
  
          execResults = queryexecutorimplbean.executeQueryWrapperByQueryID(CommonConstants.CVAuditStaticUser,postClass.getDatabase(),cvstaticparams);
          List &lt;CVAuditStaticUserClass&gt; listobject = execResults.getCvAuditStaticRowColRslt();
          log.info("CVAuditStaticUser execResults list object size:" + listobject.size());
          auditResponse.setCvAuditClassList(listobject);
  
          log.info("Converting the auditresponse object to json string");
          String json = new Gson().toJson(auditResponse);
  
          log.info("printing the json:" + json);
  
  
          return json;
      }
  </code></pre>
  
  <hr>
  
  <h2>part 3 source code  ( NEED YOUR HELP)</h2>
  
  <p><strong>DatabaseController.java</strong></p>
  
  <pre><code>@RequestMapping(value = "/AuditDisplayPostResponse", method = RequestMethod.GET,consumes=MediaType.APPLICATION_JSON_VALUE)
  public ModelAndView auditDisplayResponse(
  @RequestParam(value = "argument1", required = false) String argument1){
  
  
      log.info("inisde auditDisplayResponse method");
  
      String json = "";
  
      try {
  
          //convert string to json
          json = "[" + argument1 + "]";
  
          log.info("argument1:" + argument1);
          log.info("argument1 json:" + json);
  
  
      }
      catch(Exception e){
          e.printStackTrace();
      }
  
      return (new ModelAndView("AuditDisplayResultPage","DisplayResponse",json));
      //return (new ModelAndView("L1OutputDisplayPage","message",json));
  }
  </code></pre>