In the interests of coding hygiene, I suggest that you avoid scriptlets. That's easy to do with JSF, but if you insist....
If the bean already exists, you can access it like any session-scoped attribute:
org.test.TestBean x = (org.test.TestBean) request.getSession().getAttribute("testBean");
(Note that there is nothing scriptlet-like about this code. This could be in any Java method.)
If the managed bean hasn't been created yet, this code wouldn't trigger its creation -- instead, getAttribute will return a null reference. To access a managed bean, triggering its creation when needed: