J
jrefactors
I use scope="session" in <jsp:useBean id="user"
class="com.proj1.model.User" scope="session"/>,
and I expect the bean name user doesn't need to redeclare in other
pages,
because the bean is available throughout the session.
User Id = 1234 is shown in test1.jsp, but when the user click the
submit button, then it has error
Parsing of JSP File '/test/test2.jsp' failed:
/test/test2.jsp(1): "user" is not a defined bean variable on this page
probably occurred due to an error in /test/test2.jsp line 1:
<H1>User ID = <jsp:getProperty name="user" property="userId"/></H1>
test1.jsp
=========
<jsp:useBean id="user" class="com.proj1.model.User" scope="session"/>
<jsp:setProperty name="user" property="userId" value="1234"/>
<H1>User ID = <jsp:getProperty name="user" property="userId"/></H1>
<html>
<head>
</head>
<body>
<form action="test2.jsp" method="POST">
<input type="submit" value="submit here">
</form>
</body>
</html>
test2.jsp
=========
<H1>User ID = <jsp:getProperty name="user" property="userId"/></H1>
any ideas? please advise.
thanks!!
class="com.proj1.model.User" scope="session"/>,
and I expect the bean name user doesn't need to redeclare in other
pages,
because the bean is available throughout the session.
User Id = 1234 is shown in test1.jsp, but when the user click the
submit button, then it has error
Parsing of JSP File '/test/test2.jsp' failed:
/test/test2.jsp(1): "user" is not a defined bean variable on this page
probably occurred due to an error in /test/test2.jsp line 1:
<H1>User ID = <jsp:getProperty name="user" property="userId"/></H1>
test1.jsp
=========
<jsp:useBean id="user" class="com.proj1.model.User" scope="session"/>
<jsp:setProperty name="user" property="userId" value="1234"/>
<H1>User ID = <jsp:getProperty name="user" property="userId"/></H1>
<html>
<head>
</head>
<body>
<form action="test2.jsp" method="POST">
<input type="submit" value="submit here">
</form>
</body>
</html>
test2.jsp
=========
<H1>User ID = <jsp:getProperty name="user" property="userId"/></H1>
any ideas? please advise.
thanks!!