Tuesday, 5 April 2016

Can a JSP page instantiate a serialized bean ?


No problem !

The useBean action specifies the beanName attribute, which can be used for indicating a serialized bean.

For example
<jsp:useBean id="shop" type="shopping.CD" beanName="CD" />
<jsp:getProperty name="shop" property="album" />

Although you would have to name your serialized file "filename.ser", you only indicate "filename" as the value for the beanName attribute.

Also, you will have to place your serialized file within the WEB-INF/jsp/beans directory for it to be located by the JSP engine.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.