i previously used <jsp:useBean> tags that have facility to decide the scope of bean for page or request or session or application but now i moved to MVC architechture, where i am using BeanUtils class to set the property of bean in Servlets. Please tell me what is the default SCOPE is provided by this method? and what i have to do if i want to change the scope??
I am using syntax:
BeanUtils.populate(bean, request.getParameterMap());
The
BeanUtils#popuate()doesn't store the bean anywhere. It just populates the bean. The changes are reflected in thebeaninstance which you've there. You know, Java is Object Oriented and pass-by-value. After that line is called, the bean is populated. You just need to store the bean in the desired scope yourself.Request scope:
Session scope:
Application scope:
Either way, it's available in JSP by
${bean}. There's no page scope, but that's not relevant anyway.See also: