title: how to check request parameters not null in more simple way in jsp?
body: <p>I want to check the request parameters not null,but in my code ,I think it maybe check twice ,so could everyone give me some improvement。and I pass parameter by address bar.
  here is my code :</p>
  
  <pre><code>&lt;%
  request.setCharacterEncoding("UTF-8");
  String name,password;
  
  try {
      name = (request.getParameter("name") != null) ? request.getParameter("name") : "null";
  
      password = (request.getParameter("password") != null)? request.getParameter("password") : "null";
  %&gt;
  
  &lt;h3&gt;name:&lt;%=name%&gt;&lt;/h3&gt;
  &lt;h3&gt;password:&lt;%=password%&gt;&lt;/h3&gt;
  
  &lt;%
  }catch (NullPointerException ex){
      ex.printStackTrace();
  }
  %&gt;
  </code></pre>