この中で
z.JSP のコード オブジェクト y が存在しない場合にのみ、オブジェクト y を作成したいと考えています。調べてみましたが方法がわかりませんでした。
つまり:
if(request.getSession().getAttribute("yy") == null) {
usecase y = new y();
request.getSession().setAttribute("yy", y);
}
これは次のようにさらに単純化できます。
if(session.getAttribute("yy") == null) {
usecase y = new y();
session.setAttribute("yy", y);
}
ところで、 Java命名規則について読んでください。