title: Liferay - How to render JSP from @ResourceMapping annotated method. This method is being called from a JS file via AJAX
body: <p><strong>1st JSP: Calls a Javascript function:</strong></p>
  
  <pre><code>&lt;div class="modal-footer"&gt;
                          &lt;button type="button" class="btn btn-primary" id="continueTour" onclick="launchTutorial()"&gt;Take a Quick Tour&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Javascript function(s):</strong></p>
  
  <pre><code>function launchTutorial(){
      var enjoyhint_instance = new EnjoyHint({});
      var enjoyhint_script_steps = [
          {
              "next #newAuthorizationActive": 'To create an authorization form'
          }
  ];
      enjoyhint_instance.set(enjoyhint_script_steps);
      enjoyhint_instance.run();
  
  //Here's where i'm accessing the 'exportFile' controller method (shown further below)
      $.ajax({
           type : "POST",
           url : $('#authorizationResourceURL').val(),
           data : {action: "redirectToEmpInfoForAuthTour", tourStatus : 0},
           success : function(data){
               alert('success');
               document.open();
               document.write(data);
               document.close();
           }
       });
  </code></pre>
  
  <p><strong>Method in the controller:</strong></p>
  
  <pre><code>@ResourceMapping
          protected void exportFile(ResourceRequest request, ResourceResponse response) throws IOException {  
              String action = ParamUtil.getString(request, "action", "");
      if(action.equals("redirectToEmpInfoForAuthTour"))
              {
                  //This is where I want to return the 2nd JSP from
              }
  </code></pre>
  
  <p><strong>A brief context to what exactly I'm looking for here:</strong></p>
  
  <p>I have a JSP (1st JSP), where I'm trying to show the user a tutorial (using enjoyhints) for the portlet. As a part of this tutorial, I need to highlight elements (select boxes, text fields) <strong>which are on different pages</strong> (JSPs) of the portlet. Hence, In the Javascript function, I first highlight (this highlighting part is whats taken care of by enjoyhints) the element that's there on the 1st JSP (and this works fine), and now I want to show the user the 2nd JSP, and using enjoyhints, highlight some element in the 2nd JSP, and so on in the 3rd and 4th JSPs too.</p>
  
  <p>If anybody has an alternative way of how I can do this, kindly let me know. <strong>The main problem here is that the elements I need to highlight are on different JSP pages (of the same portlet). Had all the elements been on the same page, it would've been simple.</strong> </p>
  
  <p><strong><em>I'm using Liferay Portal, and Spring Portlet MVC as my design pattern.</em></strong></p>
  
  <p>UPDATE: <a href="https://stackoverflow.com/questions/38133287/cant-get-to-liferays-spring-portlet-mvcs-controller-from-js-by-doing-the-fo">Here's another thing that I've been trying to achieve the same thing, but no luck</a></p>