Guarda, fondamentalmente quello che andrai a fare è qualcosa del genere
codice:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
   
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>

    <h1>JSP Page</h1>    
    <%
      int screenwidth;
      try {
          screenwidth = Integer.parseInt(request.getParameter("w"));          
      }
      catch (Exception e) {
          screenwidth = -1;
      }
      if (screenwidth == -1) {%>
      <script language="javascript" type="text/javascript">
          window.location.href = "?w="+screen.width;
      </script>
          
      <% }
      else {
          out.println("Screen Width: "+screenwidth);
      }
    %>
    </body>
</html>
Comunque, se ne puoi fare a meno (tipo usando un layout "liquido", quindi con CSS ad-hoc) tanto meglio