title: Returning multiple lists with same method Spring MVC
body: <p>I've encountered a problem that seemed easy to solve, but has shown resilience.
  Namely, I'm making a web platform with a blurry search functionality. Now, a search should return a list of objects (which are all models in my case), and show them on screen in separate tabs. </p>
  
  <p>BlurrySeach (for profiles):</p>
  
  <pre><code>public List&lt;Profile&gt; blurrySearch(String keyword) {
      Session session = sessionFactory.getCurrentSession();
      Query query = session.createQuery("select p from Profile p where p.username LIKE :keyword order by p.username");
      query.setParameter("keyword", "%" + keyword + "%");
      List&lt;Profile&gt; profileList = query.list();
      session.flush();
      return profileList;
  }
  </code></pre>
  
  <p>This method is an implementation from an interface:</p>
  
  <pre><code>  List&lt;Profile&gt; blurrySearch(String title);
  </code></pre>
  
  <p>Now, I can't find a way to overload this method, since changing <code>List&lt;Profile&gt;</code> to <code>List&lt;Photos&gt;</code> doesn't change the return type nor the argument list, needed to overload the method.
  Changing the interface to <code>List blurrySearch(String title)</code> also doesn't change anything.
  It would be inefficient to make <code>blurrySearchProfile</code>, <code>blurrySearchPhotos</code>, <code>blurrySearchBlogs</code>, <code>blurrySearchShops</code> etc. as separate methods.
  How can I overload this method, to return 5 lists, like <code>profileList</code> to pass it to the <code>controller</code> and then render it on a <code>jsp</code>?</p>
  
  <p>Here's the JSP code:</p>
  
  <pre><code>&lt;div class="container-wrapper"&gt;
      &lt;div class="container"&gt;
          &lt;div class="page-header"&gt;
              &lt;h1&gt;Explore&lt;/h1&gt;
              &lt;p class="lead"&gt; Search results! &lt;/p&gt;
          &lt;/div&gt;
  
  
          &lt;!--
  
          &lt;div style=" width: 75%; margin: 0 auto;"&gt;
              &lt;div class="galleryImage"&gt;
                  &lt;c:forEach items="${profileList}" var="profile"&gt;
                      &lt;div class="imageWrapper"&gt;
  
                          &lt;a href="&lt;spring:url value="/users/${profile.username}"/&gt;"
                             style="max-height: 25%; max-width:25%; left: 50%;"&gt;
  
                              &lt;img src="&lt;c:url value="/resources/images/cosplay/profilePhotos/${profile.username}-prof.png"/&gt;" alt="image"
                                   style="max-height: 90%; max-width:90%; display: block; margin-left: auto; margin-right: auto;"&gt;
                          &lt;/a&gt;
                          &lt;div style="text-align:center;"&gt;
                              &lt;h3&gt;${profile.username}&lt;/h3&gt;
                          &lt;/div&gt;
                          &lt;/a&gt;
                          &lt;hr&gt;
                          &lt;h3&gt;${profile.description}&lt;/h3&gt;
                      &lt;/div&gt;
                  &lt;/c:forEach&gt;
              &lt;/div&gt;
  
          &lt;/div&gt; --&gt;
  
  
          &lt;div class="w3-bar w3-black"&gt;
              &lt;button class="w3-bar-item w3-button" onclick="openTab('Photos')"&gt;Photos&lt;/button&gt;
              &lt;button class="w3-bar-item w3-button" onclick="openTab('Profiles')"&gt;Profiles&lt;/button&gt;
              &lt;button class="w3-bar-item w3-button" onclick="openTab('Tutorials')"&gt;Tutorials&lt;/button&gt;
              &lt;button class="w3-bar-item w3-button" onclick="openTab('Blogs')"&gt;Blogs&lt;/button&gt;
              &lt;button class="w3-bar-item w3-button" onclick="openTab('Shops')"&gt;Shops&lt;/button&gt;
          &lt;/div&gt;
          &lt;!-- START PHOTOS --&gt;
          &lt;div id="Photos" class="tab"&gt;
              &lt;h3&gt;Photos&lt;/h3&gt;
          &lt;/div&gt;
          &lt;!-- END PHOTOS --&gt;
  
          &lt;!-- START PROFILES --&gt;
          &lt;div id="Profiles" class="tab"&gt;
              &lt;h3&gt;Profiles&lt;/h3&gt;
          &lt;/div&gt;
          &lt;!-- END PROFILES --&gt;
  
          &lt;!-- START TUTORIALS --&gt;
  
          &lt;div id="Tutorials" class="tab"&gt;
              &lt;h3&gt;Tutorials&lt;/h3&gt;
          &lt;/div&gt;
  
          &lt;!-- END TUTORIALS --&gt;
  
          &lt;!-- START BLOGS --&gt;
          &lt;div id="Blogs" class="tab"&gt;
             &lt;h3&gt;Blogss&lt;/h3&gt;
          &lt;/div&gt;
          &lt;!-- END BLOGS  --&gt;
  
          &lt;!-- START SHOPS --&gt;
          &lt;div id="Shops" class="tab"&gt;
              &lt;h3&gt;Shops&lt;/h3&gt;
          &lt;/div&gt;
          &lt;!-- END SHOPS --&gt;
  
  
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Thank you in advance! </p>