My JSP page looks like this:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="mypackage.MyClass"%>
<html>
<head><title>JSP Page</title></head>
<body>
<a href='/IGZ/imovina/prostora'>Prostori</a>
<a href='/IGZ/imovina/zemljista'>Zemljista</a>
<jsp:useBean id="mybean" scope="request" class="mypackage.MyClass" />
<jsp:setProperty name="mybean" property="prop" value="somevalue" />
</body>
</html>
When I try to get that bean from request in servlet:
MyClass mybean = (MyClass)request.getAttribute("mybean");
the result is null.
What I have done wrong?
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="mypackage.MyClass"%>
<html>
<head><title>JSP Page</title></head>
<body>
<a href='/IGZ/imovina/prostora'>Prostori</a>
<a href='/IGZ/imovina/zemljista'>Zemljista</a>
<jsp:useBean id="mybean" scope="request" class="mypackage.MyClass" />
<jsp:setProperty name="mybean" property="prop" value="somevalue" />
</body>
</html>
When I try to get that bean from request in servlet:
MyClass mybean = (MyClass)request.getAttribute("mybean");
the result is null.
What I have done wrong?