struts 2 bean is not created

Posted by Dewfy on Stack Overflow See other posts from Stack Overflow or by Dewfy
Published on 2010-04-03T10:36:14Z Indexed on 2010/04/03 10:43 UTC
Read the original article Hit count: 374

Filed under:
|
|
|

Hello colleagues!

At first some precondition to my question, I'm using struts2 + tiles2 + toplink. NO spring at all. The simplest scenario - is to display list of entities on the page. To optimize resolving JPA's EntityManager I would like to create helper (JPAResourceBean) that implements lazy load of entity manager. For this purposes I'm going to use struts2's bean declaration:

<bean  name="myfactory" class="my.model.JPAResourceBean" 
       scope="session" optional="false"/>

Why bean is not instantiated neither in session? (I'm using s:property just for debug)

...
<s:property value="#session.myfactory" default="buka.1"/>
...

nor in plain bean list:

...
<s:property value="#myfactory" default="buka.2"/>
...

May be the second part of question is - how to resolve this bean from java code?

© Stack Overflow or respective owner

Related posts about struts2

Related posts about jpa