There is -
<html>
<body>
<jsp:useBean id="user" class="user.UserData" scope="session"/>
</body>
</html>
And -
<html>
<body>
<%
Object user = session.getAttribute("user.UserData") ;
%>
</body>
</html>
Assume user.UserData
exists on the session
. is there any differnce between the two ways ?
A well known issue in JSPs is: avoid everything you can on using Java code with your page (.jsp).
So the first approach fits better, do you agree? Taglibs <jsp:useBean />
among others are a nice way of accessing code without mixing the layers. This concepts I barely introduced are part of MVC "specification".
-- EDIT --
The second way of acessing a bean is known as scriptlets and should be avoided as always as possible. A brief comparison can be found here JSTL vs jsp scriptlets.