编译 JSP 时出现重复变量错误。请帮助我。这里属性的范围(会话和请求)不同,那么为什么我不能使用它?它期望 id 必须不同,但在不同的范围内,为什么它期望?
HttpSession hs = request.getSession();
hs.setAttribute("GrandParents",new GrandParents());
request.setAttribute("GrandParents",new GrandParents());
<jsp:useBean id="GrandParents" type="test.bean.GrandParents" class="test.bean.GrandParents" scope="request"/>
Name in JSP Request tag is: <jsp:getProperty name="GrandParents" property="name" />
<jsp:useBean id ="GrandParents" type="test.bean.GrandParents" class="test.bean.GrandParents" scope="session"/>
Name in JSP Request tag is: <jsp:getProperty name="GrandParentss" property="name" />