[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index] [Home]

Re: Initialising beans from an HttpRequest


Hi Tom,

tom@goodtech.co.uk wrote:
> I'm currently developing a bean which needs to be initialised with a value
> from the current HttpRequest. Specifically, it's a shopping basket type
> bean which needs a cookie value so it can read in user-specific details of
> the basket from a database.
> 
> Is there an easy way of passing this in the <BEAN> tag? At the moment, I'm
> using the tag and calling an init(req) function to initialise it in the
> JSP source, but I'd rather avoid this...

You could set the introspect attribute of the <BEAN> tag to true. That
way, the request parameters will be copied to the bean properties
automatically. This mechanism will be replaced by a more fine grain
system in JSP 1.0.

Regards, Vincent.