title: Spring check if there is no param
body: <p>I'm building a search engine in Spring and at the moment I can query results from the database. My URL is like</p>
  
  <blockquote>
    <p>www.myurl.com/jobs=?test</p>
  </blockquote>
  
  <p>I made an "if" statement to check if the object is empty it must return a message that there is nothing found in the database. However, when I go to the </p>
  
  <blockquote>
    <p>www.myurl.com/jobs</p>
  </blockquote>
  
  <p>I also get the same message.</p>
  
  <p>Is there a way to fix this so I don't get that message? I need to check if there is no parameter - then it should return or do something else.</p>
  
  <pre><code>@RequestMapping(value = "/jobs", method=RequestMethod.GET)
  public String search(@RequestParam(value="search", required=false) String result, Model model){
      model.addAttribute("results", jobsDao.getQueryresult(result));
      return "result";
  }
  </code></pre>